Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix formatting and imports for Python 3.9 #4729

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions setuptools/_importlib.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
import importlib.resources as resources # noqa: F401
import sys

if sys.version_info < (3, 10):
import importlib_metadata as metadata # pragma: no cover
else:
import importlib.metadata as metadata # noqa: F401


if sys.version_info < (3, 9):
import importlib_resources as resources # pragma: no cover
else:
import importlib.resources as resources # noqa: F401
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that if we don't do this change, we might be able to keep the PRs thematically separated... let me see if we can do that.

49 changes: 29 additions & 20 deletions setuptools/tests/test_wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -564,14 +564,17 @@ def test_wheel_install(params):
install_tree = params.get('install_tree')
file_defs = params.get('file_defs', {})
setup_kwargs = params.get('setup_kwargs', {})
with build_wheel(
name=project_name,
version=version,
install_requires=install_requires,
extras_require=extras_require,
extra_file_defs=file_defs,
**setup_kwargs,
) as filename, tempdir() as install_dir:
with (
build_wheel(
name=project_name,
version=version,
install_requires=install_requires,
extras_require=extras_require,
extra_file_defs=file_defs,
**setup_kwargs,
) as filename,
tempdir() as install_dir,
):
_check_wheel_install(
filename, install_dir, install_tree, project_name, version, requires_txt
)
Expand All @@ -580,10 +583,13 @@ def test_wheel_install(params):
def test_wheel_install_pep_503():
project_name = 'Foo_Bar' # PEP 503 canonicalized name is "foo-bar"
version = '1.0'
with build_wheel(
name=project_name,
version=version,
) as filename, tempdir() as install_dir:
with (
build_wheel(
name=project_name,
version=version,
) as filename,
tempdir() as install_dir,
):
new_filename = filename.replace(project_name, canonicalize_name(project_name))
shutil.move(filename, new_filename)
_check_wheel_install(
Expand Down Expand Up @@ -687,14 +693,17 @@ def build_wheel(extra_file_defs=None, **kwargs):
file_defs = params.get('file_defs', {})
setup_kwargs = params.get('setup_kwargs', {})

with build_wheel(
name=project_name,
version=version,
install_requires=[],
extras_require={},
extra_file_defs=file_defs,
**setup_kwargs,
) as filename, tempdir() as install_dir:
with (
build_wheel(
name=project_name,
version=version,
install_requires=[],
extras_require={},
extra_file_defs=file_defs,
**setup_kwargs,
) as filename,
tempdir() as install_dir,
):
_check_wheel_install(
filename, install_dir, install_tree, project_name, version, None
)
Expand Down
Loading