diff options
Diffstat (limited to 'setuptools/tests/fixtures.py')
-rw-r--r-- | setuptools/tests/fixtures.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/setuptools/tests/fixtures.py b/setuptools/tests/fixtures.py new file mode 100644 index 0000000..5204c8d --- /dev/null +++ b/setuptools/tests/fixtures.py @@ -0,0 +1,23 @@ +import pytest + +from . import contexts + + +@pytest.yield_fixture +def user_override(monkeypatch): + """ + Override site.USER_BASE and site.USER_SITE with temporary directories in + a context. + """ + with contexts.tempdir() as user_base: + monkeypatch.setattr('site.USER_BASE', user_base) + with contexts.tempdir() as user_site: + monkeypatch.setattr('site.USER_SITE', user_site) + with contexts.save_user_site_setting(): + yield + + +@pytest.yield_fixture +def tmpdir_cwd(tmpdir): + with tmpdir.as_cwd() as orig: + yield orig |