Skip to content

Commit 7049c73

Browse files
committed
Add simple regression test for logging patches
1 parent bd60014 commit 7049c73

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

setuptools/tests/test_logging.py

+17
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
import inspect
12
import logging
3+
import os
24

35
import pytest
46

@@ -34,3 +36,18 @@ def test_verbosity_level(tmp_path, monkeypatch, flag, expected_level):
3436
log_level = logger.getEffectiveLevel()
3537
log_level_name = logging.getLevelName(log_level)
3638
assert log_level_name == expected_level
39+
40+
41+
def test_patching_does_not_cause_problems():
42+
# Ensure `dist.log` is only patched if necessary
43+
44+
import setuptools.logging
45+
from distutils import dist # <- load distutils after all the patches take place
46+
47+
setuptools.logging.configure()
48+
49+
if os.getenv("SETUPTOOLS_USE_DISTUTILS", "local").lower() == "local":
50+
# Modern logging infra, no problematic patching.
51+
assert isinstance(dist.log, logging.Logger)
52+
else:
53+
assert inspect.ismodule(dist.log)

0 commit comments

Comments
 (0)