diff options
| author | Eugene Triguba <eugenetriguba@gmail.com> | 2020-08-01 17:58:32 -0500 |
|---|---|---|
| committer | Eugene Triguba <eugenetriguba@gmail.com> | 2020-08-01 17:58:32 -0500 |
| commit | 032196104a59761bd75b5d594440d1e8ef16965a (patch) | |
| tree | efd67c11ac11ba7a64dc09e53b1f329916384d06 /tests/conftest.py | |
| parent | Raise FileNotFoundError if the config file does not exist (diff) | |
| download | config-file-032196104a59761bd75b5d594440d1e8ef16965a.zip | |
Add ConfigFilePath to refactor out file specific code
Diffstat (limited to 'tests/conftest.py')
| -rw-r--r-- | tests/conftest.py | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/tests/conftest.py b/tests/conftest.py index 70e88c7..faf1630 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -4,7 +4,7 @@ from typing import Callable, Tuple, Type, Union import pytest from config_file import AbstractParser, ConfigFile -from config_file.utils import create_config_path +from config_file.config_file_path import ConfigFilePath @pytest.fixture @@ -37,7 +37,7 @@ def template_original_file() -> Callable[[Path], Path]: if isinstance(template_path, str): template_path = Path(template_path) - original_path = create_config_path(template_path, original=True) + original_path = ConfigFilePath(template_path).original_path original_path.touch() original_path.write_text(template_path.read_text(encoding="utf-8")) @@ -54,12 +54,7 @@ def template_and_parser( file_type: str, template_name: str = "default" ) -> Tuple[Path, Type[AbstractParser]]: test_file = template_file(file_type, template_name) - text = test_file.read_text(encoding="utf-8") - - parser = ConfigFile._ConfigFile__find_parser_by_file_type( - file_contents=text, file_type=file_type, file_path=test_file - ) - return test_file, parser + return test_file, ConfigFile(test_file)._ConfigFile__parser return func |