Exemplo n.º 1
0
def test_relative_path_no_home(config: str):
    with pytest.raises(DatabricksError) as exc_info:
        if os.environ.get('DB_SHARD_HOME'):
            del os.environ['DB_SHARD_HOME']
        w = Workspace('foo', config)
        w._adjust_remote_path('foo/bar')

    assert exc_info.value.code == StatusCode.CONFIG_ERROR
Exemplo n.º 2
0
def test_relative_path_cfg_home(config: str):
    if os.environ.get('DB_SHARD_HOME'):
        del os.environ['DB_SHARD_HOME']
    path = 'SomeFolder'
    w = Workspace('bar', config)
    p = w._adjust_remote_path(path)
    assert p == f'/Users/[email protected]/{path}'
Exemplo n.º 3
0
def test_relative_path_env_home(config: str):
    home = '/Users/[email protected]'
    os.environ['DB_SHARD_HOME'] = home
    path = 'SomeFolder'
    w = Workspace('foo', config)
    p = w._adjust_remote_path(path)
    assert p == f'{home}/{path}'
def test_relative_path_cfg_home(config: str):
    if os.environ.get("DB_SHARD_HOME"):
        del os.environ["DB_SHARD_HOME"]
    path = "SomeFolder"
    w = Workspace("bar", config)
    p = w._adjust_remote_path(path)
    assert p == f"/Users/[email protected]/{path}"
def test_relative_path_env_home(config: str):
    home = "/Users/[email protected]"
    os.environ["DB_SHARD_HOME"] = home
    path = "SomeFolder"
    w = Workspace("foo", config)
    p = w._adjust_remote_path(path)
    assert p == f"{home}/{path}"
Exemplo n.º 6
0
def test_relative_path_cfg_and_env_home(config: str):
    home = '/Users/[email protected]'
    os.environ['DB_SHARD_HOME'] = home
    path = 'SomeFolder'
    w = Workspace('bar', config)
    p = w._adjust_remote_path(path)
    # Environment should be preferred over the config.
    assert p == f'{home}/{path}'
def test_relative_path_cfg_and_env_home(config: str):
    home = "/Users/[email protected]"
    os.environ["DB_SHARD_HOME"] = home
    path = "SomeFolder"
    w = Workspace("bar", config)
    p = w._adjust_remote_path(path)
    # Environment should be preferred over the config.
    assert p == f"{home}/{path}"
Exemplo n.º 8
0
def test_relative_path_and_username_default(config: str):
    home = '/Users/[email protected]'
    if os.environ.get('DB_SHARD_HOME'):
        del os.environ['DB_SHARD_HOME']
    path = 'SomeFolder'
    w = Workspace('baz', config)
    p = w._adjust_remote_path(path)
    assert w.home == '/Users/[email protected]'
    assert p == f'{w.home}/{path}'
def test_relative_path_and_username_default(config: str):
    home = "/Users/[email protected]"
    if os.environ.get("DB_SHARD_HOME"):
        del os.environ["DB_SHARD_HOME"]
    path = "SomeFolder"
    w = Workspace("baz", config)
    p = w._adjust_remote_path(path)
    assert w.home == "/Users/[email protected]"
    assert p == f"{w.home}/{path}"