def test_env_overrides_all(self): with patch.dict(os.environ, {"CONFIG_PATH": TEST_CONFIG_PATH}): with patch("opentopodata.config.CONFIG_PATH", MISSING_CONFIG_PATH): with patch( "opentopodata.config.EXAMPLE_CONFIG_PATH", MISSING_CONFIG_PATH ): assert config._find_config() == TEST_CONFIG_PATH
def test_missing_config(self): with patch("opentopodata.config.CONFIG_PATH", MISSING_CONFIG_PATH): with patch("opentopodata.config.EXAMPLE_CONFIG_PATH", MISSING_CONFIG_PATH): assert config._find_config() is None
def test_main_config(self, patch_config): assert config._find_config() == TEST_CONFIG_PATH
def test_example_config(self): with patch("opentopodata.config.CONFIG_PATH", MISSING_CONFIG_PATH): assert config._find_config() == config.EXAMPLE_CONFIG_PATH
def test_missing_env_overrides_with_error(self): with patch.dict(os.environ, {"CONFIG_PATH": MISSING_CONFIG_PATH}): with patch("opentopodata.config.CONFIG_PATH", TEST_CONFIG_PATH): with patch("opentopodata.config.EXAMPLE_CONFIG_PATH", TEST_CONFIG_PATH): with pytest.raises(config.ConfigError): config._find_config() == TEST_CONFIG_PATH
def test_env(self): with patch.dict(os.environ, {"CONFIG_PATH": TEST_CONFIG_PATH}): assert config._find_config() == TEST_CONFIG_PATH