From e2cc2530fc6d54ebc975c01a4ff887ce12f0a736 Mon Sep 17 00:00:00 2001 From: Pavel Aharoni Date: Wed, 29 Mar 2017 13:35:45 +0300 Subject: [SDC-6] sdc-distribution-client 1707 rebasing Change-Id: I322a05fd79beb6ba4fee4d32afffecf531b86e98 Signed-off-by: Pavel Aharoni --- .../Lib/site-packages/setuptools/tests/fixtures.py | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 jython-tosca-parser/src/main/resources/Lib/site-packages/setuptools/tests/fixtures.py (limited to 'jython-tosca-parser/src/main/resources/Lib/site-packages/setuptools/tests/fixtures.py') diff --git a/jython-tosca-parser/src/main/resources/Lib/site-packages/setuptools/tests/fixtures.py b/jython-tosca-parser/src/main/resources/Lib/site-packages/setuptools/tests/fixtures.py new file mode 100644 index 0000000..c70c38c --- /dev/null +++ b/jython-tosca-parser/src/main/resources/Lib/site-packages/setuptools/tests/fixtures.py @@ -0,0 +1,27 @@ +try: + from unittest import mock +except ImportError: + 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 -- cgit 1.2.3-korg