Changeset - 8fa9a0ffe6f7
[Not reviewed]
0 2 0
Brett Smith - 4 years ago 2020-04-13 02:24:34
brettcsmith@brettcsmith.org
tests: Set XDG_CONFIG_HOME for safety.
2 files changed with 4 insertions and 2 deletions:
0 comments (0 inline, 0 general)
tests/conftest.py
Show inline comments
...
 
@@ -3,13 +3,15 @@ import os
 
import pytest
 

	
 
from . import testutil
 

	
 
@pytest.fixture(scope='session', autouse=True)
 
def clean_environment(tmpdir_factory):
 
    config_path_s = str(testutil.test_path('userconfig'))
 
    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'))
 
    os.environ['HOME'] = config_path_s
 
    os.environ['XDG_CACHE_HOME'] = str(tmpdir_factory.mktemp('.cache'))
 
    os.environ['XDG_CONFIG_HOME'] = config_path_s
tests/test_config.py
Show inline comments
...
 
@@ -311,9 +311,9 @@ def test_config_file_path(config_path):
 
def test_config_file_path_respects_xdg_config_home():
 
    with update_environ(XDG_CONFIG_HOME='/etc'):
 
        config = config_mod.Config()
 
        assert config.config_file_path() == Path('/etc/conservancy_beancount/config.ini')
 

	
 
def test_config_file_path_with_subdir():
 
    expected = Path('~/.config/conftest/config.ini').expanduser()
 
    expected = testutil.test_path('userconfig/conftest/config.ini')
 
    config = config_mod.Config()
 
    assert config.config_file_path('conftest') == expected
0 comments (0 inline, 0 general)