Skip to content

Commit

Permalink
Suppress path mangling when running tests. Ref #169.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Aug 13, 2022
1 parent e5a5a9f commit 5fa1e54
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions conftest.py
Expand Up @@ -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)
)

0 comments on commit 5fa1e54

Please sign in to comment.