Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
forsyth2 committed Apr 13, 2022
1 parent c50d47e commit 1d1c40f
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 11 deletions.
33 changes: 32 additions & 1 deletion docs/source/dev_guide/testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Integration tests must be run on an LCRC machine. Run all integration tests by d
.. code::
pip install . # Install your changes (`python -m pip install .` also works)
# Run steps in the section below ("Commands to run before running integration tests")
python -m unittest tests/integration/test_*.py # Run all integration tests

Commands to run before running integration tests
Expand All @@ -37,6 +38,19 @@ Before running ``tests/integration/test_complete_run.py`` run the following:
rm -rf /lcrc/group/e3sm/ac.forsyth2/zppy_test_complete_run_output/v2.LR.historical_0201/post
zppy -c tests/integration/test_complete_run.cfg
Before running ``tests/integration/test_bundles.py`` run the following:

.. code::
rm -rf /lcrc/group/e3sm/public_html/diagnostic_output/ac.forsyth2/zppy_test_bundles_www/v2.LR.historical_0201
rm -rf /lcrc/group/e3sm/ac.forsyth2/zppy_test_bundles_output/v2.LR.historical_0201/post
zppy -c tests/integration/test_bundles.cfg
# bundle1 and bundle2 should run. After they finish, run:
rm /lcrc/group/e3sm/ac.forsyth2/zppy_test_bundles_output/v2.LR.historical_0201/post/scripts/bundle3.bash
# (If this file isn't deleted, zppy will fail because it assumes bundle3 is already running).
zppy -c tests/integration/test_bundles.cfg
# bundle3 and ilamb_run should run
Commands to run to replace outdated expected files
--------------------------------------------------

Expand Down Expand Up @@ -85,7 +99,24 @@ To replace the expected images for ``test_complete_run.py`` run the following:
cd <top level of zppy repo>
# Rerun test
python -m unittest tests/integration/test_complete_run.py
To replace the expected images for ``test_bundles.py`` run the following:

.. code::
# rm -rf /lcrc/group/e3sm/public_html/zppy_test_resources/expected_bundles
# Your output will now become the new expectation.
# Copy output so you don't have to rerun zppy to generate the output.
# cp -r /lcrc/group/e3sm/public_html/diagnostic_output/ac.forsyth2/zppy_test_bundles_www/v2.LR.historical_0201 /lcrc/group/e3sm/public_html/zppy_test_resources/expected_bundles
# mkdir -p /lcrc/group/e3sm/public_html/zppy_test_resources/expected_bundles/bundle_files
# cp -r /lcrc/group/e3sm/ac.forsyth2/zppy_test_bundles_output/v2.LR.historical_0201/post/scripts/bundle*.bash /lcrc/group/e3sm/public_html/zppy_test_resources/expected_bundles/bundle_files
# cd /lcrc/group/e3sm/public_html/zppy_test_resources/expected_bundles
# This file will list all the expected images.
# find . -type f -name '*.png' > ../image_list_expected_bundles.txt
cd <top level of zppy repo>
# Rerun test
# python -m unittest tests/integration/test_bundles.py
Automated tests
===============

Expand Down
1 change: 0 additions & 1 deletion tests/integration/test_bundles.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ years = "1850:1854:2",

[tc_analysis]
active = True
# TODO: debug if error relates to issue #180?
bundle = "bundle3" # Let bundle1 finish first because "e3sm_diags: atm_monthly_180x360_aave_mvm" requires "ts: atm_monthly_180x360_aave"
scratch = "/lcrc/globalscratch/ac.forsyth2"
years = "1850:1852:2",
Expand Down
8 changes: 0 additions & 8 deletions tests/integration/test_bundles.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
# TODO: add documentation on this test
# rm -rf /lcrc/group/e3sm/public_html/zppy_test_resources/expected_bundles
# cp -r /lcrc/group/e3sm/public_html/diagnostic_output/ac.forsyth2/zppy_test_bundles_www/v2.LR.historical_0201 /lcrc/group/e3sm/public_html/zppy_test_resources/expected_bundles
# mkdir -p /lcrc/group/e3sm/public_html/zppy_test_resources/expected_bundles/bundle_files
# cp -r /lcrc/group/e3sm/ac.forsyth2/zppy_test_bundles_output/v2.LR.historical_0201/post/scripts/bundle*.bash /lcrc/group/e3sm/public_html/zppy_test_resources/expected_bundles/bundle_files
# cd /lcrc/group/e3sm/public_html/zppy_test_resources/expected_bundles
# find . -type f -name '*.png' > ../image_list_expected_bundles.txt
# python -m unittest tests/integration/test_bundles.py
import os
import unittest

Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_complete_run.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import unittest

from utils import check_mismatched_images
from tests.integration.utils import check_mismatched_images


class TestCompleteRun(unittest.TestCase):
Expand Down
8 changes: 8 additions & 0 deletions tests/test_sections.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ def test_sections(self):
actual_default = config["default"]
expected_default = {
"active": False,
"bundle": "",
"campaign": "none",
"case": "CASE",
"debug": False,
Expand Down Expand Up @@ -108,6 +109,7 @@ def test_sections(self):
actual_task = actual_tasks[0]
expected_task = {
"active": "True",
"bundle": "",
"area_nm": "area",
"campaign": "none",
"case": "CASE",
Expand Down Expand Up @@ -155,6 +157,7 @@ def test_sections(self):
actual_task = actual_tasks[0]
expected_task = {
"active": "True",
"bundle": "",
"campaign": "none",
"case": "CASE",
"debug": False,
Expand Down Expand Up @@ -201,6 +204,7 @@ def test_subsections(self):
actual_default = config["default"]
expected_default = {
"active": False,
"bundle": "",
"campaign": "none",
"case": "CASE",
"debug": False,
Expand Down Expand Up @@ -264,6 +268,7 @@ def test_subsections(self):
expected_task = {
"active": "True",
"area_nm": "area",
"bundle": "",
"campaign": "none",
"case": "CASE",
"cmip_metadata": "e3sm_to_cmip/default_metadata.json",
Expand Down Expand Up @@ -296,6 +301,7 @@ def test_subsections(self):
expected_task = {
"active": "True",
"area_nm": "area",
"bundle": "",
"campaign": "none",
"case": "CASE",
"cmip_metadata": "e3sm_to_cmip/default_metadata.json",
Expand Down Expand Up @@ -356,6 +362,7 @@ def test_subsections(self):
actual_task = actual_tasks[0]
expected_task = {
"active": "True",
"bundle": "",
"campaign": "none",
"case": "CASE",
"debug": False,
Expand Down Expand Up @@ -383,6 +390,7 @@ def test_subsections(self):
actual_task = actual_tasks[1]
expected_task = {
"active": "True",
"bundle": "",
"campaign": "none",
"case": "CASE",
"debug": False,
Expand Down

0 comments on commit 1d1c40f

Please sign in to comment.