comparison venv/lib/python2.7/site-packages/setuptools/tests/fixtures.py @ 0:d67268158946 draft

planemo upload commit a3f181f5f126803c654b3a66dd4e83a48f7e203b
author bcclaywell
date Mon, 12 Oct 2015 17:43:33 -0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:d67268158946
1 try:
2 from unittest import mock
3 except ImportError:
4 import mock
5 import pytest
6
7 from . import contexts
8
9
10 @pytest.yield_fixture
11 def user_override():
12 """
13 Override site.USER_BASE and site.USER_SITE with temporary directories in
14 a context.
15 """
16 with contexts.tempdir() as user_base:
17 with mock.patch('site.USER_BASE', user_base):
18 with contexts.tempdir() as user_site:
19 with mock.patch('site.USER_SITE', user_site):
20 with contexts.save_user_site_setting():
21 yield
22
23
24 @pytest.yield_fixture
25 def tmpdir_cwd(tmpdir):
26 with tmpdir.as_cwd() as orig:
27 yield orig