Skip to content

Commit

Permalink
Remove hack around distutils.dist.log, no longer relevant with pypa/d…
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Oct 5, 2022
1 parent 2aaa95e commit 1546d40
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 27 deletions.
6 changes: 0 additions & 6 deletions setuptools/logging.py
Expand Up @@ -24,12 +24,6 @@ def configure():
format="{message}", style='{', handlers=handlers, level=logging.DEBUG)
monkey.patch_func(set_threshold, distutils.log, 'set_threshold')

# For some reason `distutils.log` module is getting cached in `distutils.dist`
# and then loaded again when patched,
# implying: id(distutils.log) != id(distutils.dist.log).
# Make sure the same module object is used everywhere:
distutils.dist.log = distutils.log


def set_threshold(level):
logging.root.setLevel(level*10)
Expand Down
21 changes: 0 additions & 21 deletions setuptools/tests/test_distutils_adoption.py
Expand Up @@ -135,24 +135,3 @@ def test_modules_are_not_duplicated_on_import(
cmd = ['python', '-c', script]
output = popen_text(venv.run)(cmd, env=win_sr(env)).strip()
assert output == "success"


ENSURE_LOG_IMPORT_IS_NOT_DUPLICATED = r"""
# Similar to ENSURE_IMPORTS_ARE_NOT_DUPLICATED
import distutils.dist as dist
from distutils import log
assert dist.log == log, (
f"\n{dist.log}\n!=\n{log}"
)
print("success")
"""


@pytest.mark.parametrize("distutils_version", "local stdlib".split())
def test_log_module_is_not_duplicated_on_import(distutils_version, tmpdir_cwd, venv):
env = dict(SETUPTOOLS_USE_DISTUTILS=distutils_version)
cmd = ['python', '-c', ENSURE_LOG_IMPORT_IS_NOT_DUPLICATED]
output = popen_text(venv.run)(cmd, env=win_sr(env)).strip()
assert output == "success"

0 comments on commit 1546d40

Please sign in to comment.