-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #480 from 3dgeo-heidelberg/pytests_rev
Regression testing setup + fixturized pytests
- Loading branch information
Showing
23 changed files
with
709 additions
and
268 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,3 +28,6 @@ dependencies: | |
- pytest | ||
- laspy | ||
- lazrs-python | ||
- pandas | ||
- scipy | ||
- pooch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import pytest | ||
|
||
|
||
pytest.register_assert_rewrite("pytests.pcloud_utils") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import os | ||
import pathlib | ||
import pooch | ||
import pytest | ||
import shutil | ||
|
||
|
||
TEST_DATA_ARCHIVE = "https://github.com/dokempf/helios-test-data/releases/download/2024-08-29/data.tar.gz" | ||
TEST_DATA_CHECKSUM = "df4490f41cd5f9e17fd794429ea7b2fa1f0ad58848b5df44199d24c820cb324b" | ||
|
||
|
||
@pytest.fixture | ||
def regression_data(request): | ||
""" A fixture that ensures the existence of regression data | ||
Returns the Path to where that data is located after (cached) download | ||
from GitHub. | ||
""" | ||
|
||
if not request.config.getoption("--regression-tests"): | ||
return None | ||
|
||
# Define the cache location | ||
cache = pooch.os_cache("helios") | ||
|
||
# Trigger the download | ||
pooch.retrieve( | ||
TEST_DATA_ARCHIVE, | ||
TEST_DATA_CHECKSUM, | ||
path=cache, | ||
downloader=pooch.HTTPDownloader(timeout=(3, None)), | ||
processor=pooch.Untar(extract_dir="."), | ||
) | ||
|
||
return cache | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def output_dir(request): | ||
dir = pathlib.Path(os.getcwd()) / "pytest-output" | ||
|
||
yield dir | ||
|
||
if request.config.getoption("--delete-output"): | ||
shutil.rmtree(dir) | ||
|
||
|
||
def pytest_addoption(parser): | ||
parser.addoption( | ||
"--regression-tests", | ||
action="store_true", | ||
default=False, | ||
help="run regression tests", | ||
) | ||
|
||
parser.addoption( | ||
"--delete-output", | ||
action="store_true", | ||
default=False, | ||
help="run regression tests", | ||
) |
Oops, something went wrong.