diff options
| author | Eugene Triguba <eugenetriguba@gmail.com> | 2020-08-06 09:43:44 -0500 |
|---|---|---|
| committer | Eugene Triguba <eugenetriguba@gmail.com> | 2020-08-06 09:43:44 -0500 |
| commit | d2f3161dac2313e4109ba2159fdc0d43e50506f8 (patch) | |
| tree | a66a1a08601e0b6ee6ebee71ba8ec3e0b904d453 /tests/test_yaml_parser.py | |
| parent | Remove MissingDependencyError in favor of ImportError (diff) | |
| download | config-file-d2f3161dac2313e4109ba2159fdc0d43e50506f8.zip | |
Test extras parsers & move imports inside those parsers
Diffstat (limited to 'tests/test_yaml_parser.py')
| -rw-r--r-- | tests/test_yaml_parser.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/test_yaml_parser.py b/tests/test_yaml_parser.py index e69de29..1f46692 100644 --- a/tests/test_yaml_parser.py +++ b/tests/test_yaml_parser.py @@ -0,0 +1,24 @@ +from unittest.mock import patch + +import pytest + +from config_file.yaml_parser import YamlParser + + +def test_that_import_error_is_raised_if_no_ruamelyaml(): + """ + config_file.yaml_parser.YamlParser + + Ensure an import error is raised if ruamel.yaml is not + installed. + """ + with pytest.raises(ImportError) as error: + + with patch("builtins.__import__") as mock_import: + mock_import.side_effect = ImportError + YamlParser("") + + assert ( + "Install the `yaml` extra first with `pip install config-file[yaml]`." + in str(error) + ) |