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 9d0905c commit 7cc6a72
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ long_description = file: README.md
long_description_content_type = text/markdown
name = plover_local_env_var
url = https://github.com/paulfioravanti/plover-local-env-var
version = 0.3.7
version = 0.3.8

[options]
install_requires =
Expand Down
19 changes: 8 additions & 11 deletions test/config/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,19 @@

@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_array_env_var_names_config_path():
return (
(Path(__file__).parent / "files/non_array_env_var_names.json").resolve()
)
return _path("files/non_array_env_var_names.json")

@pytest.fixture
def valid_env_var_names_mac_linux_config_path():
path = (
Path(__file__).parent / "files/valid_env_var_names_mac_linux.json"
).resolve()
path = _path("files/valid_env_var_names_mac_linux.json")
with path.open(encoding="utf-8") as file:
config_data = json.load(file)
file.close()
Expand All @@ -34,9 +30,7 @@ def valid_env_var_names_mac_linux_config_path():

@pytest.fixture
def valid_env_var_names_windows_config_path():
path = (
Path(__file__).parent / "files/valid_env_var_names_windows.json"
).resolve()
path = _path("files/valid_env_var_names_windows.json")
with path.open(encoding="utf-8") as file:
config_data = json.load(file)
file.close()
Expand All @@ -46,3 +40,6 @@ def valid_env_var_names_windows_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 7cc6a72

Please sign in to comment.