diff options
author | Anderson Bravalheri <andersonbravalheri@gmail.com> | 2022-11-22 16:49:37 +0000 |
---|---|---|
committer | Anderson Bravalheri <andersonbravalheri@gmail.com> | 2022-11-22 16:49:37 +0000 |
commit | 02cb2a7996c4b3fe783beb72edede24fbe8db0ca (patch) | |
tree | 214d9f7b7aa0e76b87004f7cbbcc5f3b6cd6c71a /setuptools/tests | |
parent | 6b53b05f7cfd023c0e5e8d965de166650036386c (diff) | |
download | python-setuptools-git-02cb2a7996c4b3fe783beb72edede24fbe8db0ca.tar.gz |
Simplify patching in test
Diffstat (limited to 'setuptools/tests')
-rw-r--r-- | setuptools/tests/test_manifest.py | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/setuptools/tests/test_manifest.py b/setuptools/tests/test_manifest.py index 5a45c61e..a3628824 100644 --- a/setuptools/tests/test_manifest.py +++ b/setuptools/tests/test_manifest.py @@ -322,20 +322,15 @@ class TestFileListTest(TempDirTestCase): to ensure setuptools' version of FileList keeps parity with distutils. """ - @pytest.fixture(autouse=True) + @pytest.fixture(autouse=os.getenv("SETUPTOOLS_USE_DISTUTILS") == "stdlib") def _compat_record_logs(self, monkeypatch, caplog): """Account for stdlib compatibility""" - if ( - os.getenv("SETUPTOOLS_USE_DISTUTILS") == "stdlib" - and hasattr(log, "Log") - and not isinstance(log.Log, logging.Logger) - ): - def _log(_logger, level, msg, args): - exc = sys.exc_info() - rec = logging.LogRecord("distutils", level, "", 0, msg, args, exc) - caplog.records.append(rec) - - monkeypatch.setattr(log.Log, "_log", _log) + def _log(_logger, level, msg, args): + exc = sys.exc_info() + rec = logging.LogRecord("distutils", level, "", 0, msg, args, exc) + caplog.records.append(rec) + + monkeypatch.setattr(log.Log, "_log", _log) def get_records(self, caplog, *levels): return [r for r in caplog.records if r.levelno in levels] |