Skip to content

Commit

Permalink
Refactor some fixtures
Browse files Browse the repository at this point in the history
  • Loading branch information
paulfioravanti committed Oct 4, 2024
1 parent 438fbb3 commit 2b41c7e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 16 deletions.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ long_description = file: README.md
long_description_content_type = text/markdown
name = plover_platform_specific_translation
url = https://github.com/paulfioravanti/plover-platform-specific-translation
version = 0.2.9
version = 0.2.10

[options]
install_requires =
Expand Down
24 changes: 9 additions & 15 deletions test/config/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,27 @@

@pytest.fixture
def bad_config_path():
return (Path(__file__).parent / "files/bad_json_data.json").resolve()
return _path("files/bad_json_data.json")

@pytest.fixture
def non_existent_config_path():
return (Path(__file__).parent / "files/non_existent.json").resolve()
return _path("files/non_existent.json")

@pytest.fixture
def non_dict_platform_translations_config_path():
return (
Path(__file__).parent / "files/non_dict_platform_translations.json"
).resolve()
return _path("files/non_dict_platform_translations.json")

@pytest.fixture
def dict_non_list_platform_translations_config_path():
return (
Path(__file__).parent / "files/dict_non_list_platform_translations.json"
).resolve()
return _path("files/dict_non_list_platform_translations.json")

@pytest.fixture
def dict_list_non_string_platform_translations_config_path():
return (
Path(__file__).parent
/ "files/dict_list_non_string_platform_translations.json"
).resolve()
return _path("files/dict_list_non_string_platform_translations.json")

@pytest.fixture
def valid_platform_translations_config_path():
path = (
Path(__file__).parent / "files/valid_platform_translations.json"
).resolve()
path = _path("files/valid_platform_translations.json")
with path.open(encoding="utf-8") as file:
config_data = json.load(file)
file.close()
Expand All @@ -44,3 +35,6 @@ def valid_platform_translations_config_path():
with path.open("w", encoding="utf-8") as file:
json.dump(config_data, file, indent=2)
file.close()

def _path(path):
return (Path(__file__).parent / path).resolve()

0 comments on commit 2b41c7e

Please sign in to comment.