Skip to content

Commit

Permalink
Update obsolete Python 3.7 code
Browse files Browse the repository at this point in the history
  • Loading branch information
Avasam committed Nov 7, 2023
1 parent 32952c7 commit 03a7826
Show file tree
Hide file tree
Showing 14 changed files with 1,706 additions and 1,786 deletions.
447 changes: 220 additions & 227 deletions _distutils_hack/__init__.py

Large diffs are not rendered by default.

113 changes: 54 additions & 59 deletions conftest.py
Original file line number Diff line number Diff line change
@@ -1,59 +1,54 @@
import sys

import pytest


pytest_plugins = 'setuptools.tests.fixtures'


def pytest_addoption(parser):
parser.addoption(
"--package_name",
action="append",
default=[],
help="list of package_name to pass to test functions",
)
parser.addoption(
"--integration",
action="store_true",
default=False,
help="run integration tests (only)",
)


def pytest_configure(config):
config.addinivalue_line("markers", "integration: integration tests")
config.addinivalue_line("markers", "uses_network: tests may try to download files")


collect_ignore = [
'tests/manual_test.py',
'setuptools/tests/mod_with_constant.py',
'setuptools/_distutils',
'_distutils_hack',
'setuptools/extern',
'pkg_resources/extern',
'pkg_resources/tests/data',
'setuptools/_vendor',
'pkg_resources/_vendor',
'setuptools/config/_validate_pyproject',
]


if sys.version_info < (3, 6):
collect_ignore.append('docs/conf.py') # uses f-strings
collect_ignore.append('pavement.py')


if sys.version_info < (3, 9) or sys.platform == 'cygwin':
collect_ignore.append('tools/finalize.py')


@pytest.fixture(autouse=True)
def _skip_integration(request):
running_integration_tests = request.config.getoption("--integration")
is_integration_test = request.node.get_closest_marker("integration")
if running_integration_tests and not is_integration_test:
pytest.skip("running integration tests only")
if not running_integration_tests and is_integration_test:
pytest.skip("skipping integration tests")
import sys

import pytest


pytest_plugins = 'setuptools.tests.fixtures'


def pytest_addoption(parser):
parser.addoption(
"--package_name",
action="append",
default=[],
help="list of package_name to pass to test functions",
)
parser.addoption(
"--integration",
action="store_true",
default=False,
help="run integration tests (only)",
)


def pytest_configure(config):
config.addinivalue_line("markers", "integration: integration tests")
config.addinivalue_line("markers", "uses_network: tests may try to download files")


collect_ignore = [
'tests/manual_test.py',
'setuptools/tests/mod_with_constant.py',
'setuptools/_distutils',
'_distutils_hack',
'setuptools/extern',
'pkg_resources/extern',
'pkg_resources/tests/data',
'setuptools/_vendor',
'pkg_resources/_vendor',
'setuptools/config/_validate_pyproject',
]


if sys.version_info < (3, 9) or sys.platform == 'cygwin':
collect_ignore.append('tools/finalize.py')


@pytest.fixture(autouse=True)
def _skip_integration(request):
running_integration_tests = request.config.getoption("--integration")
is_integration_test = request.node.get_closest_marker("integration")
if running_integration_tests and not is_integration_test:
pytest.skip("running integration tests only")
if not running_integration_tests and is_integration_test:
pytest.skip("skipping integration tests")
7 changes: 4 additions & 3 deletions pkg_resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
"""

import sys

if sys.version_info < (3, 8):
raise RuntimeError("Python 3.8 or later is required")

import os
import io
import time
Expand Down Expand Up @@ -82,9 +86,6 @@
__import__('pkg_resources.extern.packaging.markers')
__import__('pkg_resources.extern.packaging.utils')

if sys.version_info < (3, 5):
raise RuntimeError("Python 3.5 or later is required")

# declare some globals that will be defined later to
# satisfy the linters.
require = None
Expand Down
3 changes: 0 additions & 3 deletions pkg_resources/tests/test_pkg_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,6 @@ def make_distribution_no_version(tmpdir, basename):
# will detect it and yield it.
dist_dir.join('temp.txt').ensure()

if sys.version_info < (3, 6):
dist_dir = str(dist_dir)

dists = list(pkg_resources.distributions_from_metadata(dist_dir))
assert len(dists) == 1
(dist,) = dists
Expand Down
Loading

0 comments on commit 03a7826

Please sign in to comment.