diff options
| author | Jason R. Coombs <jaraco@jaraco.com> | 2015-01-02 18:38:36 -0500 |
|---|---|---|
| committer | Jason R. Coombs <jaraco@jaraco.com> | 2015-01-02 18:38:36 -0500 |
| commit | 16ee10c47583a4a2b7480af6fc5a205343acfdfd (patch) | |
| tree | 7cfbb6d488a92fa01ddb86d6f226f549ad26a01e /setuptools/tests/fixtures.py | |
| parent | 866ff739f6e64aaaefcf7816263410527c9f55f7 (diff) | |
| parent | 41f2c5ec8dd669747f3cfd8d6b2ae9a40d219545 (diff) | |
| download | python-setuptools-git-16ee10c47583a4a2b7480af6fc5a205343acfdfd.tar.gz | |
Merge with 10.2.1
--HG--
branch : feature/issue-229
Diffstat (limited to 'setuptools/tests/fixtures.py')
| -rw-r--r-- | setuptools/tests/fixtures.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/setuptools/tests/fixtures.py b/setuptools/tests/fixtures.py new file mode 100644 index 00000000..0b1eaf5f --- /dev/null +++ b/setuptools/tests/fixtures.py @@ -0,0 +1,24 @@ +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): + with contexts.save_user_site_setting(): + yield + + +@pytest.yield_fixture +def tmpdir_cwd(tmpdir): + with tmpdir.as_cwd() as orig: + yield orig |
