summaryrefslogtreecommitdiff
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
commita3b6ffa272814f512b6194fd94132ff288237172 (patch)
tree25d1b360687eb7f7d8fcdc6e6ac651c3556984bf
parentaf198643021519285bad58afe7fede0ac9c9a785 (diff)
downloadpython-setuptools-bitbucket-a3b6ffa272814f512b6194fd94132ff288237172.tar.gz
Move fixture to a fixtures module and make that fixture available globally.
-rw-r--r--conftest.py1
-rw-r--r--setuptools/tests/fixtures.py16
-rw-r--r--setuptools/tests/test_bdist_egg.py15
3 files changed, 17 insertions, 15 deletions
diff --git a/conftest.py b/conftest.py
new file mode 100644
index 00000000..a513bb9e
--- /dev/null
+++ b/conftest.py
@@ -0,0 +1 @@
+pytest_plugins = 'setuptools.tests.fixtures'
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
diff --git a/setuptools/tests/test_bdist_egg.py b/setuptools/tests/test_bdist_egg.py
index 08bc75d7..ccfb2ea7 100644
--- a/setuptools/tests/test_bdist_egg.py
+++ b/setuptools/tests/test_bdist_egg.py
@@ -4,13 +4,11 @@ import os
import re
import pytest
-import mock
from setuptools.dist import Distribution
from . import contexts
-
SETUP_PY = """\
from setuptools import setup
@@ -18,19 +16,6 @@ setup(name='foo', py_modules=['hi'])
"""
@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
-
-
-@pytest.yield_fixture
def setup_context(tmpdir):
with (tmpdir/'setup.py').open('w') as f:
f.write(SETUP_PY)