コード例 #1
0
def test_configured_cache_location():
    from confuse import Configuration
    c = Configuration('bogus', 'bogus')
    c.clear()
    here = Path('./servicex-dude').absolute()
    c['cache_path'] = str(here)

    p = get_configured_cache_path(c)

    # Should default to temp directory - should work on all platforms!
    assert p.exists()
    assert str(p) == str(here)
コード例 #2
0
def test_configured_cache_temp_location():
    from confuse import Configuration
    c = Configuration('bogus', 'bogus')
    c.clear()
    c['cache_path'] = '/tmp/servicex-dude'

    p = get_configured_cache_path(c)

    # Should default to temp directory - should work on all platforms!
    assert p.exists()
    assert str(p).startswith(tempfile.gettempdir())
    assert 'servicex-dude' in str(p)
コード例 #3
0
def test_cache_expansion_username():
    '''On windows this will expand one way, and on linux another. So need to be a little careful here!
    '''
    from confuse import Configuration
    c = Configuration('bogus', 'bogus')
    c.clear()
    c['cache_path'] = '/tmp/servicex_${UserName}'

    # Get the right answer, depending on the definition of USER
    u_name = os.environ['USER'] if 'USER' in os.environ else os.environ[
        'UserName']
    path_name = f'servicex_{u_name}'

    p = get_configured_cache_path(c)

    # Should default to temp directory - should work on all platforms!
    assert p.name == path_name