diff options
| author | Eugene Triguba <eugenetriguba@gmail.com> | 2020-08-07 20:25:00 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-08-07 20:25:00 -0500 |
| commit | 05dba35cab34c2524b945da0164327b7b8a1159d (patch) | |
| tree | e1f263a316839c0d32a413c120a3c92426f36817 /tests/test_toml_parser.py | |
| parent | Create python-package-ci.yml (diff) | |
| parent | Fix ConfigFile default (diff) | |
| download | config-file-05dba35cab34c2524b945da0164327b7b8a1159d.zip | |
Merge pull request #24 from eugenetriguba/dev
v0.11.0
Diffstat (limited to 'tests/test_toml_parser.py')
| -rw-r--r-- | tests/test_toml_parser.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/test_toml_parser.py b/tests/test_toml_parser.py new file mode 100644 index 0000000..845e78e --- /dev/null +++ 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) + ) |