From 3fa782f5b5e3bd4445a5db63c0fce5aaac2d4ac3 Mon Sep 17 00:00:00 2001 From: Eugene Triguba Date: Mon, 20 Jul 2020 22:55:40 -0500 Subject: Add work in progress tests --- tests/test_toml_parser.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 tests/test_toml_parser.py (limited to 'tests/test_toml_parser.py') diff --git a/tests/test_toml_parser.py b/tests/test_toml_parser.py new file mode 100644 index 0000000..e69de29 -- cgit v1.2.3 From d2f3161dac2313e4109ba2159fdc0d43e50506f8 Mon Sep 17 00:00:00 2001 From: Eugene Triguba Date: Thu, 6 Aug 2020 09:43:44 -0500 Subject: Test extras parsers & move imports inside those parsers --- tests/test_toml_parser.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'tests/test_toml_parser.py') diff --git a/tests/test_toml_parser.py b/tests/test_toml_parser.py index e69de29..845e78e 100644 --- a/tests/test_toml_parser.py +++ b/tests/test_toml_parser.py @@ -0,0 +1,24 @@ +from unittest.mock import patch + +import pytest + +from config_file.toml_parser import TomlParser + + +def test_that_import_error_is_raised_if_no_tomlkit(): + """ + config_file.toml_parser.TomlParser + + Ensure an import error is raised if tomlkit is not + installed. + """ + with pytest.raises(ImportError) as error: + + with patch("builtins.__import__") as mock_import: + mock_import.side_effect = ImportError + TomlParser("") + + assert ( + "Install the `toml` extra first with `pip install config-file[toml]`." + in str(error) + ) -- cgit v1.2.3