summaryrefslogtreecommitdiff
path: root/setuptools/tests/fixtures.py
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2015-01-01 23:31:22 -0500
committerJason R. Coombs <jaraco@jaraco.com>2015-01-01 23:31:22 -0500
commitf8285cac4b95e6b43869e27093ef04552e665681 (patch)
tree32fa72721e61c40046d4a110df00b0a083e9a33d /setuptools/tests/fixtures.py
parentc3319da5b2e4a8d597a5b27d4a034199eea78745 (diff)
downloadpython-setuptools-git-f8285cac4b95e6b43869e27093ef04552e665681.tar.gz
Move fixture to a fixtures module and make that fixture available globally.
Diffstat (limited to 'setuptools/tests/fixtures.py')
-rw-r--r--setuptools/tests/fixtures.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/setuptools/tests/fixtures.py b/setuptools/tests/fixtures.py
new file mode 100644
index 00000000..6b0e53f3
--- /dev/null
+++ b/setuptools/tests/fixtures.py
@@ -0,0 +1,16 @@
+import mock
+import pytest
+
+from . import contexts
+
+@pytest.yield_fixture
+def user_override():
+ """
+ Override site.USER_BASE and site.USER_SITE with temporary directories in
+ a context.
+ """
+ with contexts.tempdir() as user_base:
+ with mock.patch('site.USER_BASE', user_base):
+ with contexts.tempdir() as user_site:
+ with mock.patch('site.USER_SITE', user_site):
+ yield