Exemplo n.º 1
0
def test_expand_path_raises_value_error_on_relative_project_path():
    path = Path("relative/path")
    with pytest.raises(ValueError) as excinfo:
        _expand_path(project_path=path, conf_dictionary={})

    assert (str(excinfo.value) ==
            f"project_path must be an absolute path. Received: {path}")
Exemplo n.º 2
0
 def test_after_catalog_created_hook_is_called(self, context_with_hooks,
                                               caplog):
     catalog = context_with_hooks.catalog
     config_loader = context_with_hooks.config_loader
     relevant_records = [
         r for r in caplog.records if r.name == LoggingHooks.handler_name
     ]
     record = relevant_records[0]
     assert record.getMessage() == "Catalog created"
     assert record.catalog == catalog
     assert record.conf_creds == config_loader.get("credentials*")
     assert record.conf_catalog == _expand_path(
         project_path=context_with_hooks.project_path,
         conf_dictionary=config_loader.get("catalog*"),
     )
     assert record.save_version is None
     assert record.load_versions is None
     assert record.run_id == "mocked context with hooks run id"
Exemplo n.º 3
0
def test_expand_path_not_changing_non_relative_path(project_path: Path,
                                                    input_conf: Dict[str, Any],
                                                    expected: Dict[str, Any]):
    assert _expand_path(project_path, input_conf) == expected
Exemplo n.º 4
0
def test_expand_path_for_all_known_filepath_keys(project_path: Path,
                                                 input_conf: Dict[str, Any],
                                                 expected: Dict[str, Any]):
    assert _expand_path(project_path, input_conf) == expected