Skip to content

Commit

Permalink
add unit tests for examples, add default args.
Browse files Browse the repository at this point in the history
  • Loading branch information
RasmusOrsoe committed Sep 25, 2023
1 parent c6ee6b3 commit 124f67a
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 8 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
editable: true
- name: Run unit tests and generate coverage report
run: |
coverage run --source=graphnet -m pytest tests/
coverage run --source=graphnet -m pytest tests/ examples/ --ignore=05_pisa
coverage xml -o coverage.xml
- name: Work around permission issue
run: |
Expand Down Expand Up @@ -88,7 +88,7 @@ jobs:
- name: Run unit tests and generate coverage report
run: |
set -o pipefail # To propagate exit code from pytest
coverage run --source=graphnet -m pytest tests/ --ignore=tests/data/ --ignore=tests/deployment/
coverage run --source=graphnet -m pytest tests/ examples/ --ignore=tests/data/ --ignore=tests/deployment/ --ignore=examples/01_icetray --ignore=examples/05_pisa
coverage report -m
build-macos:
Expand All @@ -108,5 +108,5 @@ jobs:
- name: Run unit tests and generate coverage report
run: |
set -o pipefail # To propagate exit code from pytest
coverage run --source=graphnet -m pytest tests/ --ignore=tests/data/ --ignore=tests/deployment/
coverage run --source=graphnet -m pytest tests/ examples/ --ignore=tests/data/ --ignore=tests/deployment/ --ignore=examples/01_icetray --ignore=examples/05_pisa
coverage report -m
8 changes: 7 additions & 1 deletion examples/02_data/01_read_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,13 @@ def main(backend: str) -> None:
"""
)

parser.add_argument("backend", choices=["sqlite", "parquet"])
parser.add_argument(
"backend",
choices=["sqlite", "parquet"],
default="sqlite",
const="sqlite",
nargs="?",
)

args = parser.parse_args()

Expand Down
2 changes: 1 addition & 1 deletion examples/04_training/01_train_dynedge.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ def main(

parser.with_standard_arguments(
"gpus",
("max-epochs", 5),
("max-epochs", 1),
"early-stopping-patience",
("batch-size", 16),
"num-workers",
Expand Down
2 changes: 1 addition & 1 deletion examples/04_training/02_train_tito_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ def main(

parser.with_standard_arguments(
"gpus",
("max-epochs", 5),
("max-epochs", 1),
("early-stopping-patience", 2),
("batch-size", 16),
"num-workers",
Expand Down
2 changes: 1 addition & 1 deletion examples/04_training/03_train_dynedge_from_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def main(
"dataset-config",
"model-config",
"gpus",
("max-epochs", 5),
("max-epochs", 1),
"early-stopping-patience",
("batch-size", 16),
"num-workers",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def main(
),
),
"gpus",
("max-epochs", 5),
("max-epochs", 1),
"early-stopping-patience",
("batch-size", 16),
"num-workers",
Expand Down

0 comments on commit 124f67a

Please sign in to comment.