Commit 849b034a authored by Jason R. Coombs's avatar Jason R. Coombs

Don't rely on mock in the plugin

parent 15e0f14c
try:
from unittest import mock
except ImportError:
import mock
import pytest import pytest
from . import contexts from . import contexts
@pytest.yield_fixture @pytest.yield_fixture
def user_override(): def user_override(monkeypatch):
""" """
Override site.USER_BASE and site.USER_SITE with temporary directories in Override site.USER_BASE and site.USER_SITE with temporary directories in
a context. a context.
""" """
with contexts.tempdir() as user_base: with contexts.tempdir() as user_base:
with mock.patch('site.USER_BASE', user_base): monkeypatch.setattr('site.USER_BASE', user_base)
with contexts.tempdir() as user_site: with contexts.tempdir() as user_site:
with mock.patch('site.USER_SITE', user_site): monkeypatch.setattr('site.USER_SITE', user_site)
with contexts.save_user_site_setting(): with contexts.save_user_site_setting():
yield yield
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment