diff options
| author | Jason R. Coombs <jaraco@jaraco.com> | 2022-08-13 10:00:15 -0400 |
|---|---|---|
| committer | Jason R. Coombs <jaraco@jaraco.com> | 2022-08-13 10:06:09 -0400 |
| commit | 5fa1e54969497de5c191298bf45f0fb8131a8a6f (patch) | |
| tree | 86d99b6f8f058f55b1eaa3980606ac066a54da3f | |
| parent | e5a5a9f067aeb5b316299e2a77599f4f87f371e7 (diff) | |
| download | python-setuptools-git-5fa1e54969497de5c191298bf45f0fb8131a8a6f.tar.gz | |
Suppress path mangling when running tests. Ref pypa/distutils#169.
| -rw-r--r-- | conftest.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/conftest.py b/conftest.py index 14afaea1..d07febe1 100644 --- a/conftest.py +++ b/conftest.py @@ -135,3 +135,25 @@ def cleanup_testfn(): os.remove(path) elif os.path.isdir(path): shutil.rmtree(path) + + +# from pytest-dev/pytest#363 +@pytest.fixture(scope="session") +def monkeysession(request): + from _pytest.monkeypatch import MonkeyPatch + + mpatch = MonkeyPatch() + yield mpatch + mpatch.undo() + + +@pytest.fixture(autouse=True, scope="session") +def suppress_path_mangle(monkeysession): + """ + Disable the path mangling in CCompiler. Workaround for #169. + """ + from distutils import ccompiler + + monkeysession.setattr( + ccompiler.CCompiler, '_mangle_base', staticmethod(lambda x: x) + ) |
