-
Notifications
You must be signed in to change notification settings - Fork 4
Use all test data #54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
2b9086b
use request to read test data without downloading them
SarahAlidoost 6e50ebe
use all test data for root_dynamics tests
SarahAlidoost 05b4e87
Merge branch 'main' into use_all_test_data
SarahAlidoost 375a2f5
remove test data
SarahAlidoost b4920cc
remove unused class from utils, fix dtype in utils
SarahAlidoost 716405d
refactor tests to use all testdata
SarahAlidoost 01d6eb4
fix leaf_dynamics
SarahAlidoost 198fa4a
refactor sigmoid approx and add tests for it
SarahAlidoost fac85e5
download test data locally once
SarahAlidoost 46c86e6
Merge branch 'main' into use_all_test_data
SarahAlidoost File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -67,3 +67,6 @@ venv.bak/ | |
| *.swp | ||
| *.swo | ||
| *.orig | ||
|
|
||
| # test data | ||
| tests/physical_models/test_data/*.yaml | ||
This file contains hidden or 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 hidden or 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
|
SarahAlidoost marked this conversation as resolved.
|
This file contains hidden or 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,38 @@ | ||
| from pathlib import Path | ||
| import pytest | ||
| import requests | ||
|
|
||
| LOCAL_TEST_DIR = Path(__file__).parent / "test_data" | ||
| BASE_PCSE_URL = "https://raw.githubusercontent.com/ajwdewit/pcse/refs/heads/master/tests/test_data" | ||
|
|
||
| model_names = [ | ||
| "leafdynamics", | ||
| "rootdynamics", | ||
| "potentialproduction", | ||
| ] | ||
| FILE_NAMES = [ | ||
| f"test_{model_name}_wofost72_{i:02d}.yaml" for model_name in model_names for i in range(1, 45) | ||
| ] | ||
|
|
||
|
|
||
| def download_file(file_name, local_test_dir=LOCAL_TEST_DIR, base_url=BASE_PCSE_URL): | ||
| """Download a single file from GitHub raw URL to local test_data folder.""" | ||
|
|
||
| url = f"{base_url}/{file_name}" | ||
| local_test_dir.mkdir(exist_ok=True) | ||
| local_path = local_test_dir / file_name | ||
|
|
||
| if local_path.exists(): | ||
| return # Already downloaded | ||
|
|
||
| print(f"Downloading {file_name} from {url}...") | ||
| response = requests.get(url) | ||
| response.raise_for_status() # Raise exception on HTTP error | ||
| local_path.write_bytes(response.content) | ||
|
|
||
|
|
||
| @pytest.fixture(scope="session", autouse=True) | ||
| def download_test_files(): | ||
| """Download all required test files before running tests.""" | ||
| for file_name in FILE_NAMES: | ||
| download_file(file_name) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.