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

318: update tests/data for MTD 3d cluster #334

Merged
merged 6 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 0 additions & 2 deletions .coveragerc

This file was deleted.

14 changes: 11 additions & 3 deletions .github/workflows/sonarqube.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,16 @@ jobs:
sonarqube:
name: SonarQube Scan
runs-on: ubuntu-latest


services:
mariadb:
image: mariadb:latest
env:
MARIADB_ROOT_PASSWORD: root_password
ports:
- 3306:3306
options: --health-cmd="healthcheck.sh --connect --innodb_initialized" --health-interval=10s --health-timeout=5s --health-retries=3

steps:

- name: Check if PR is from a fork
Expand Down Expand Up @@ -75,8 +84,7 @@ jobs:

- name: Run Pytests
run: |
coverage run --append -m pytest METreformat
coverage run --append -m pytest METreadnc
coverage run --append -m pytest

- name: Output coverage report
run: coverage report -m
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/unit_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,7 @@ jobs:

- name: Test with pytest
run: |
coverage run --append -m pytest METdbLoad/test
coverage run --append -m pytest METreformat
coverage run --append -m pytest METreadnc
coverage run --append -m pytest
coverage report -m
echo "Finished unit tests and coverage"

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
VERSION MODEL DESC FCST_LEAD FCST_VALID OBS_LEAD OBS_VALID T_DELTA FCST_T_BEG FCST_T_END FCST_RAD FCST_THR OBS_T_BEG OBS_T_END OBS_RAD OBS_THR FCST_VAR FCST_UNITS FCST_LEV OBS_VAR OBS_UNITS OBS_LEV OBJECT_ID OBJECT_CAT SPACE_CENTROID_DIST TIME_CENTROID_DELTA AXIS_DIFF SPEED_DELTA DIRECTION_DIFF VOLUME_RATIO START_TIME_DELTA END_TIME_DELTA INTERSECTION_VOLUME DURATION_DIFF INTEREST
V12.0.0 FCST NA NA 20100517_010000 NA 20100517_010000 010000 -2 3 2 >=0.5 -1 1 2 >=0.5 APCP_01 kg/m^2 A01 APCP_01 kg/m^2 A01 CF001_CO001 CF001_CO001 6.89 -0.01 3.894 0.37 31.96 1.19 0 0 47061 0 -1.000
V12.0.0 FCST NA NA 20100517_010000 NA 20100517_010000 010000 -2 3 2 >=0.5 -1 1 2 >=0.5 APCP_01 kg/m^2 A01 APCP_01 kg/m^2 A01 CF002_CO002 CF002_CO002 60.32 -1.06 5.214 1.07 3.46 0.75 0 0 0 0 -1.000
V12.0.0 FCST NA NA 20100517_010000 NA 20100517_010000 010000 -2 3 2 >=0.5 -1 1 2 >=0.5 APCP_01 kg/m^2 A01 APCP_01 kg/m^2 A01 CF003_CO003 CF003_CO003 65.19 -0.67 62.974 -3.31 177.03 0.98 0 -1 7 -1 -1.000
V12.0.0 FCST NA NA 20100517_010000 NA 20100517_010000 010000 -2 3 2 >=0.5 -1 1 2 >=0.5 APCP_01 kg/m^2 A01 APCP_01 kg/m^2 A01 CF004_CO004 CF004_CO004 4.72 0.84 2.870 -1.85 1.95 0.90 -2 0 1151 2 -1.000
9 changes: 8 additions & 1 deletion METdbLoad/test/test_met_db_load.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ def assert_count_rows(cur, table, expected_count):
{
"mtd_2d_obj": 278,
"mtd_3d_obj_single": 8,
"mtd_3d_obj_pair": 4,
"mtd_header": 24,
},
),
(
Expand Down Expand Up @@ -128,9 +130,14 @@ def test_met_db_table_counts(
expected_counts,
):

load_flags = {
"mode_header_db_check": "true",
"mtd_header_db_check": "true",
}

test_args = dict_to_args(
{
"xmlfile": str(get_xml_test_file(tmp_path, met_data_dir, met_tool)),
"xmlfile": str(get_xml_test_file(tmp_path, met_data_dir, met_tool, load_flags=load_flags)),
"index": "true",
"tmpdir": [str(tmp_path)],
"loglevel": None,
Expand Down
2 changes: 1 addition & 1 deletion METdbLoad/test/test_read_data_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def test_mtd_loads(tmp_path, get_xml_loadfile):
)

# number of files
assert len(XML_LOADFILE.load_files) == 2
assert len(XML_LOADFILE.load_files) == 3
# number of lines of data
assert FILE_DATA.mtd_2d_data.shape == (278, 43)
assert FILE_DATA.mtd_3d_single_data.shape == (8, 48)
Expand Down
4 changes: 2 additions & 2 deletions internal/scripts/sonarqube/sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ sonar.projectKey=METdataio
sonar.projectName=METdataio
sonar.projectVersion=SONAR_PROJECT_VERSION
sonar.branch.name=SONAR_BRANCH_NAME
sonar.sources=METdbLoad,METreadnc,METreformat
sonar.coverage.exclusions=**/test/*,docs/**,setup.py
sonar.sources=METdbLoad/ush,METreadnc/util,METreformat
sonar.coverage.exclusions=**/test/*,**/tests/*,docs/**,setup.py
sonar.python.coverage.reportPaths=coverage.xml
sonar.sourceEncoding=UTF-8

Expand Down
19 changes: 19 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

[tool.pytest.ini_options]
addopts = "-q"
testpaths = [
"METdbLoad/test",
"METreadnc/test",
"METreformat/test",
]

[tool.coverage.run]
relative_files = true
source = [
"METdbLoad/ush",
"METreadnc/util",
"METreformat/",
]
omit = [
"METreformat/test/*"
]
Loading