summaryrefslogtreecommitdiff
path: root/setuptools/tests/fixtures.py
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2016-09-27 14:24:22 -0500
committerJason R. Coombs <jaraco@jaraco.com>2016-09-27 14:24:22 -0500
commit66a6724da8eda3336643dee086da2a3495e6422a (patch)
tree64043e9782491bde3a3a9ae2314cc59451a6c9c0 /setuptools/tests/fixtures.py
parentdf3905616933c90af95e99f705b800a2f5c1c921 (diff)
parent35ea365b50bd1a64375fdbcce187affab22af3b7 (diff)
downloadpython-setuptools-git-setuptools-scm.tar.gz
Merge with mastersetuptools-scm
Diffstat (limited to 'setuptools/tests/fixtures.py')
-rw-r--r--setuptools/tests/fixtures.py16
1 files changed, 6 insertions, 10 deletions
diff --git a/setuptools/tests/fixtures.py b/setuptools/tests/fixtures.py
index c70c38cb..5204c8d1 100644
--- a/setuptools/tests/fixtures.py
+++ b/setuptools/tests/fixtures.py
@@ -1,24 +1,20 @@
-try:
- from unittest import mock
-except ImportError:
- import mock
import pytest
from . import contexts
@pytest.yield_fixture
-def user_override():
+def user_override(monkeypatch):
"""
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):
- with contexts.save_user_site_setting():
- yield
+ 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