From d8b0a56fb4c61ad6ec916e9b080b80a99e84710a Mon Sep 17 00:00:00 2001 From: Brett Smith Date: Wed, 25 Mar 2020 14:03:25 -0400 Subject: [PATCH] tests: Set a default CONSERVANCY_REPOSITORY for testing. --- tests/conftest.py | 2 +- tests/test_config.py | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index d82c6c9..f6a1a3b 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -6,9 +6,9 @@ from . import testutil @pytest.fixture(scope='session', autouse=True) def clean_environment(): - os.environ.pop('CONSERVANCY_REPOSITORY', None) os.environ.pop('RTAUTH', None) os.environ.pop('RTPASSWD', None) os.environ.pop('RTSERVER', None) os.environ.pop('RTUSER', None) + os.environ['CONSERVANCY_REPOSITORY'] = str(testutil.test_path('repository')) os.environ['HOME'] = str(testutil.test_path('userconfig')) diff --git a/tests/test_config.py b/tests/test_config.py index 2af8d1c..c771ac2 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -73,13 +73,13 @@ def update_environ(**kwargs): _update_environ(revert) def test_repository_from_environment(): - with update_environ(CONSERVANCY_REPOSITORY='/usr/local'): - config = config_mod.Config() - assert config.repository_path().parts == ('/', 'usr', 'local') + config = config_mod.Config() + assert config.repository_path() == testutil.test_path('repository') def test_no_repository(): - config = config_mod.Config() - assert config.repository_path() is None + with update_environ(CONSERVANCY_REPOSITORY=None): + config = config_mod.Config() + assert config.repository_path() is None def test_no_rt_credentials(): with update_environ(HOME=testutil.TESTS_DIR):