예제 #1
0
    def test_basic_paths(self):
        appdirs = importlib.import_module('appdirs')

        expected = appdirs.user_config_dir()
        assert SpecialResolver(Path).user.config == expected

        expected = appdirs.site_config_dir()
        assert SpecialResolver(Path).site.config == expected

        expected = appdirs.user_config_dir('My App', 'Me')
        assert SpecialResolver(Path, 'My App', 'Me').user.config == expected
예제 #2
0
 def test_unix_paths_fallback(self, tmpdir, monkeypatch, feign_linux):
     "Without XDG_CONFIG_HOME set, ~/.config should be used."
     fake_home = tmpdir / '_home'
     monkeypatch.delitem(os.environ, 'XDG_CONFIG_HOME', raising=False)
     monkeypatch.setitem(os.environ, 'HOME', str(fake_home))
     expected = Path('~/.config').expanduser()
     assert SpecialResolver(Path).user.config == expected
예제 #3
0
    def test_reused_SpecialResolver(self):
        """
        Passing additional args and kwargs to SpecialResolver should be
        passed through to each invocation of the function in appdirs.
        """
        appdirs = importlib.import_module('appdirs')

        adp = SpecialResolver(Path, version="1.0")
        res = adp.user.config

        expected = appdirs.user_config_dir(version="1.0")
        assert res == expected
예제 #4
0
 def test_unix_paths(self, tmpdir, monkeypatch, feign_linux):
     fake_config = tmpdir / '_config'
     monkeypatch.setitem(os.environ, 'XDG_CONFIG_HOME', str(fake_config))
     expected = str(tmpdir / '_config')
     assert SpecialResolver(Path).user.config == expected