Skip to content
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

153-End to End build test. #266

Merged
merged 30 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
aeb978e
Updated functions in cli.py to use argv[Optional[Sequence[str]] inste…
charles-turner-1 Nov 18, 2024
9e785f4
Skeleton of e2e test
charles-turner-1 Nov 18, 2024
6206a7e
Peelin apart argparse for e2e test
charles-turner-1 Nov 18, 2024
a4aab12
Pass build in using argparse
charles-turner-1 Nov 18, 2024
c7efe95
End to end build test working - now to add queries
charles-turner-1 Nov 18, 2024
1f4feea
Pre-commit
charles-turner-1 Nov 18, 2024
02fdd23
Updated workflow to only run tests in 'tests' dir
charles-turner-1 Nov 18, 2024
e194ead
Lots of tests working - mostly just the content tests to finish
charles-turner-1 Nov 20, 2024
be30446
Pre-commit
charles-turner-1 Nov 20, 2024
37d3a68
End to end test done & working. Now just needs a workflow trigger
charles-turner-1 Nov 20, 2024
436676a
formatting
charles-turner-1 Nov 20, 2024
9be91f3
Merge branch 'main' into 153-e2e
charles-turner-1 Nov 20, 2024
1d69c30
Removed unused build_subset.sh file
charles-turner-1 Nov 20, 2024
5071f0b
Merge branch '153-e2e' of https://github.com/ACCESS-NRI/access-nri-in…
charles-turner-1 Nov 20, 2024
6511acc
Removed some redundant stuff (Marc's comments)
charles-turner-1 Nov 24, 2024
ab511ab
Moved end to end test into tests dir (yet to see if we can get it all…
charles-turner-1 Nov 24, 2024
efd3fcd
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 24, 2024
7a56289
Added workflow & shell script to submit it to Gadi
charles-turner-1 Nov 24, 2024
b91d1df
Clean up test file (remove unused string, etc etc)
charles-turner-1 Nov 24, 2024
823613b
Clean up test file (remove unused string, scope=session => module)
charles-turner-1 Nov 24, 2024
d7715be
Merge branch '153-e2e' of https://github.com/ACCESS-NRI/access-nri-in…
charles-turner-1 Nov 24, 2024
04d14c4
Merge branch 'main' into 153-e2e
charles-turner-1 Nov 24, 2024
40918c0
Added reference to e2e tests in docs
charles-turner-1 Nov 25, 2024
96b88a6
Merge branch '153-e2e' of https://github.com/ACCESS-NRI/access-nri-in…
charles-turner-1 Nov 25, 2024
dd8c090
Cleaned up fixture, removed redundant second conftest.py, fixed confi…
charles-turner-1 Nov 25, 2024
268c98f
Cleaning up a few tests where mocks no longer necessary
charles-turner-1 Nov 25, 2024
a63bdab
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 25, 2024
4629f27
Merge remote-tracking branch 'origin/main' into 153-e2e
marc-white Nov 26, 2024
54abc39
Fixed workflow trigger & type hint that disappeared
charles-turner-1 Nov 26, 2024
6d543fd
Pre-commit
charles-turner-1 Nov 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:

- name: Run tests
shell: bash -l {0}
run: coverage run -m --source=access_nri_intake pytest
run: coverage run -m --source=access_nri_intake pytest tests

- name: Generate coverage report
shell: bash -l {0}
Expand Down
Empty file added e2e/__init__.py
Empty file.
9 changes: 9 additions & 0 deletions e2e/configs/access-om2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
builder: AccessOm2Builder

translator: DefaultTranslator

sources:

- metadata_yaml: /g/data/ik11/outputs/access-om2/1deg_jra55_ryf9091_gadi/metadata.yaml
path:
- /g/data/ik11/outputs/access-om2/1deg_jra55_ryf9091_gadi
9 changes: 9 additions & 0 deletions e2e/configs/cmip5.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
builder: null

translator: Cmip5Translator

sources:

- metadata_yaml: /g/data/xp65/admin/access-nri-intake-catalog/config/metadata_sources/cmip5-al33/metadata.yaml
path:
- /g/data/al33/catalog/v2/esm/catalog.json
69 changes: 69 additions & 0 deletions e2e/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Copyright 2023 ACCESS-NRI and contributors. See the top-level COPYRIGHT file for details.
# SPDX-License-Identifier: Apache-2.0

import os
import warnings
from datetime import datetime
from pathlib import Path

from pytest import fixture

here = os.path.abspath(os.path.dirname(__file__))


def _get_xfail():
"""
Get the XFAILS environment variable. We use a default of 1, indicating we expect
to add xfail marker to `test_parse_access_ncfile[AccessOm2Builder-access-om2/output000/ocean/ocean_grid.nc-expected0-True]`
unless specified.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably should be updated to reference which test a value of 1 will point to.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good spot

"""
xfails_default = 1

try:
return int(os.environ["XFAILS"])
except KeyError:
warnings.warn(
message=(
"XFAILS enabled by default as coordinate discovery disabled by default. "
"This will be deprecated when coordinate discovery is enabled by default"
),
category=PendingDeprecationWarning,
)
return xfails_default


_add_xfail = _get_xfail()


@fixture(scope="session")
def test_data():
return Path(os.path.join(here, "data"))


@fixture(scope="session")
def BASE_DIR(tmp_path_factory):
yield tmp_path_factory.mktemp("catalog-dir")


@fixture(scope="session")
def v_num():
return datetime.now().strftime("v%Y-%m-%d")


def pytest_collection_modifyitems(config, items):
"""
This function is called by pytest to modify the items collected during test
collection. We use it here to mark the xfail tests in
test_builders::test_parse_access_ncfile when we check the file contents & to
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above

ensure we correctly get xfails if we don't have cordinate discovery enabled
in intake-esm.
"""
for item in items:
if (
item.name
in (
"test_parse_access_ncfile[AccessOm2Builder-access-om2/output000/ocean/ocean_grid.nc-expected0-True]",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above

)
and _add_xfail
):
item.add_marker("xfail")
Loading
Loading