blob: 225c2ea3981b141e1af29e26f621e0c93c097ac0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
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
|