Skip to content

Commit 8f8e190

Browse files
Jayracineabn
authored andcommitted
remove some instances of branching code supporting older python versions
1 parent 3bbec0c commit 8f8e190

File tree

8 files changed

+9
-35
lines changed

8 files changed

+9
-35
lines changed

docs/managing-environments.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ to activate one explicitly, see [Switching environments](#switching-between-envi
3030
To easily switch between Python versions, it is recommended to
3131
use [pyenv](https://github.com/pyenv/pyenv) or similar tools.
3232

33-
For instance, if your project is Python 2.7 only, a standard workflow
33+
For instance, if your project is Python 3.6 only, a standard workflow
3434
would be:
3535

3636
```bash
37-
pyenv install 2.7.15
38-
pyenv local 2.7.15 # Activate Python 2.7 for the current project
37+
pyenv install 3.6.15
38+
pyenv local 3.6.15 # Activate Python 3.6 for the current project
3939
poetry install
4040
```
4141
{{% /note %}}

poetry/repositories/installed_repository.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,7 @@ def get_package_paths(cls, env: Env, name: str) -> Set[Path]:
6363
if line and not line.startswith(("#", "import ", "import\t")):
6464
path = Path(line)
6565
if not path.is_absolute():
66-
try:
67-
path = lib.joinpath(path).resolve()
68-
except FileNotFoundError:
69-
# this is required to handle pathlib oddity on win32 python==3.5
70-
path = lib.joinpath(path)
66+
path = lib.joinpath(path).resolve()
7167
paths.add(path)
7268

7369
src_path = env.path / "src" / name

sonnet

-2
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,6 @@ class MakeReleaseCommand(Command):
230230
subprocess.check_output(
231231
[python, "-V"], stderr=subprocess.STDOUT, shell=WINDOWS
232232
)
233-
if version == "3.4" and WINDOWS:
234-
continue
235233

236234
subprocess.check_output([python, "-m", "pip", "install", "pip", "-U"])
237235
except subprocess.CalledProcessError:

tests/installation/test_installer.py

+1-6
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import itertools
44
import json
5-
import sys
65

76
from pathlib import Path
87

@@ -1751,11 +1750,7 @@ def test_installer_test_solver_finds_compatible_package_for_dependency_python_no
17511750

17521751
expected = fixture("with-conditional-dependency")
17531752
assert locker.written_data == expected
1754-
1755-
if sys.version_info >= (3, 5, 0):
1756-
assert 1 == installer.executor.installations_count
1757-
else:
1758-
assert 0 == installer.executor.installations_count
1753+
assert 1 == installer.executor.installations_count
17591754

17601755

17611756
def test_installer_required_extras_should_not_be_removed_when_updating_single_dependency(

tests/installation/test_installer_old.py

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from __future__ import unicode_literals
22

33
import itertools
4-
import sys
54

65
from pathlib import Path
76

@@ -1447,11 +1446,7 @@ def test_installer_test_solver_finds_compatible_package_for_dependency_python_no
14471446
assert locker.written_data == expected
14481447

14491448
installs = installer.installer.installs
1450-
1451-
if sys.version_info >= (3, 5, 0):
1452-
assert len(installs) == 1
1453-
else:
1454-
assert len(installs) == 0
1449+
assert len(installs) == 1
14551450

14561451

14571452
def test_installer_required_extras_should_not_be_removed_when_updating_single_dependency(

tests/utils/fixtures/setups/pyyaml/setup.py

+2-5
Original file line numberDiff line numberDiff line change
@@ -308,10 +308,7 @@ def run(self):
308308
build_cmd = self.get_finalized_command("build")
309309
build_cmd.run()
310310
sys.path.insert(0, build_cmd.build_lib)
311-
if sys.version_info[0] < 3:
312-
sys.path.insert(0, "tests/lib")
313-
else:
314-
sys.path.insert(0, "tests/lib3")
311+
sys.path.insert(0, "tests/lib3")
315312
import test_all
316313

317314
if not test_all.main([]):
@@ -337,7 +334,7 @@ def run(self):
337334
url=URL,
338335
download_url=DOWNLOAD_URL,
339336
classifiers=CLASSIFIERS,
340-
package_dir={"": {2: "lib", 3: "lib3"}[sys.version_info[0]]},
337+
package_dir={"": "lib3"},
341338
packages=["yaml"],
342339
ext_modules=[
343340
Extension(

tests/utils/fixtures/setups/sqlalchemy/setup.py

-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
from setuptools.command.test import test as TestCommand
1313

1414
cmdclass = {}
15-
if sys.version_info < (2, 7):
16-
raise Exception("SQLAlchemy requires Python 2.7 or higher.")
1715

1816
cpython = platform.python_implementation() == "CPython"
1917

tests/utils/test_env.py

+1-6
Original file line numberDiff line numberDiff line change
@@ -963,12 +963,7 @@ def test_env_system_packages(tmp_path, config):
963963

964964
EnvManager(config).build_venv(path=venv_path, flags={"system-site-packages": True})
965965

966-
if sys.version_info >= (3, 3):
967-
assert "include-system-site-packages = true" in pyvenv_cfg.read_text()
968-
elif (2, 6) < sys.version_info < (3, 0):
969-
assert not venv_path.joinpath(
970-
"lib", "python2.7", "no-global-site-packages.txt"
971-
).exists()
966+
assert "include-system-site-packages = true" in pyvenv_cfg.read_text()
972967

973968

974969
def test_env_finds_the_correct_executables(tmp_dir, manager):

0 commit comments

Comments
 (0)