diff --git a/konfik/__init__.py b/konfik/__init__.py index ba3469d..a251707 100644 --- a/konfik/__init__.py +++ b/konfik/__init__.py @@ -178,7 +178,9 @@ def _load_config(self): return self._load_yaml(config_path) else: - raise NotImplementedError(f"Config type '{self._config_ext}' is not supported") + raise NotImplementedError( + f"Config type '{self._config_ext}' is not supported" + ) @staticmethod def _load_env(config_path): @@ -187,7 +189,9 @@ def _load_env(config_path): try: # Instead of using load_dotenv(), this is done to avoid recursively searching for dotenv file. # There is no element of surprise. If the file is not found in the explicit path, this will raise an error! - dotenv_file = find_dotenv(filename=config_path, raise_error_if_not_found=True, usecwd=True) + dotenv_file = find_dotenv( + filename=config_path, raise_error_if_not_found=True, usecwd=True + ) if dotenv_file: config = dotenv_values(dotenv_file) @@ -233,7 +237,9 @@ def get_by_path(dct, key_list): try: return reduce(operator.getitem, key_list, dct) except KeyError as e: - raise MissingVariableError(f"No such variable '{e.args[0]}' exists") from None + raise MissingVariableError( + f"No such variable '{e.args[0]}' exists" + ) from None class KonfikCLI: @@ -241,7 +247,9 @@ class KonfikCLI: def build_parser(self): parser = argparse.ArgumentParser( - description=colorize.colorize_title("\nKonfik -- The strangely familiar config parser ⚙️\n") + description=colorize.colorize_title( + "\nKonfik -- The strangely familiar config parser ⚙️\n" + ) ) # Add arguments diff --git a/tests/test_konfik.py b/tests/test_konfik.py index ee08872..a0fe978 100644 --- a/tests/test_konfik.py +++ b/tests/test_konfik.py @@ -193,7 +193,6 @@ def test_konfik(tmp_path, toml_str): assert konfik._config_ext == "toml" - def test_konfik_toml(tmp_path, toml_str, capfd): """Test the Konfik class for toml.""" @@ -262,7 +261,6 @@ def test_konfik_env(tmp_path, dotenv_str): assert config.IP == "10.0.0.1" assert config.DC == "eqdc10" - with pytest.raises(MissingVariableError): config.fakekey @@ -307,7 +305,6 @@ def test_konfik_json(tmp_path, json_str, capfd): assert config.clients.data == [["gamma", "delta"], [1, 2]] - with pytest.raises(MissingVariableError): config.fakekey @@ -350,7 +347,6 @@ def test_konfik_yaml(tmp_path, yaml_str, capfd): assert config.clients.data == [["gamma", "delta"], [1, 2]] - with pytest.raises(MissingVariableError): config.fakekey @@ -363,4 +359,4 @@ def test_konfik_cli(tmp_path, toml_str, capfd): # Load toml from the test toml path konfik_cli = KonfikCLI() parser = konfik_cli.build_parser() - #args = parser.parse_args() + # args = parser.parse_args()