tests: Set a default CONSERVANCY_REPOSITORY for testing.

This commit is contained in:
Brett Smith 2020-03-25 14:03:25 -04:00
parent 91a436abd5
commit d8b0a56fb4
2 changed files with 6 additions and 6 deletions

View file

@ -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'))

View file

@ -73,11 +73,11 @@ 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')
assert config.repository_path() == testutil.test_path('repository')
def test_no_repository():
with update_environ(CONSERVANCY_REPOSITORY=None):
config = config_mod.Config()
assert config.repository_path() is None