From 6d68858f51ae630bf739f646afcdec40e6075866 Mon Sep 17 00:00:00 2001 From: esoteric-ephemera Date: Wed, 22 May 2024 10:19:57 -0700 Subject: [PATCH] precommit --- tests/conftest.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 7e8f3458..02ffe77d 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -4,7 +4,6 @@ import os import pytest -from shutil import copyfileobj TEST_DIR = os.path.dirname(__file__) TEST_FILES = f"{TEST_DIR}/files" @@ -15,14 +14,15 @@ def _patch_get_potential_energy(monkeypatch) -> None: """Monkeypatch the multiprocessing.cpu_count() function to always return 64.""" monkeypatch.setattr(multiprocessing, "cpu_count", lambda: 64) -def get_gzip_or_unzipped(test_file_or_dir : str) -> str: - """ + +def get_gzip_or_unzipped(test_file_or_dir: str) -> str: + """ Return the file or its unzipped version, depending on which one exists. Running pytest in CI seems to unzip the test files prior to testing. To get around this behavior, we return the whichever file exists, its gzipped version or the unzipped version. - + Args: test_file_or_dir (str) : the name of the test file or directory Returns: @@ -31,8 +31,8 @@ def get_gzip_or_unzipped(test_file_or_dir : str) -> str: """ if os.path.isdir(test_file_or_dir): return test_file_or_dir - + for file_to_test in [test_file_or_dir, test_file_or_dir.split(".gz")[0], test_file_or_dir.split(".GZ")[0]]: if os.path.isfile(file_to_test): return file_to_test - raise FileNotFoundError(f"Cannot find {test_file_or_dir}") \ No newline at end of file + raise FileNotFoundError(f"Cannot find {test_file_or_dir}")