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

RTX Code Release (PI-4): T-Route Integration Test additions #849

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

taddyb
Copy link

@taddyb taddyb commented Dec 17, 2024

Today, Raytheon demo'd the FIM-Services capability to:

Provide a full complement of unit tests for T-Route. Each modular component will have a suite of tests. The purpose of this work is to fill in the test suite for capabilities built by teams outside of this contract and to ensure any changes to T-Route not impact National Water model, or Replace and Route, capabilities

This Pull Request contains features related to all unit tests within the src/ directory. There will be an additional PR created to house all features related to integration tests within the test/ directory.

See #848 for the unit test PR related to this deliverable

Additions

  • integration tests for the following t-route modules:
    • troute-network
    • troute-routing
    • troute-nwm
    • bmi_troute

Removals

Changes

  • Moved all testing functionality which requires the usage of config files into the test/ folder
    • This follows the pattern of integration tests living outside of the source code, and the unit tests being within src/
  • Since many of the .pyx tests/fortran were deprecated, or were pointing to outdated file links, I've attempted to move all of the functionality within them into their module specific integration tests
    • The idea is if it is too cumbersome to test a function that is rarely updated, then we should at minimum test the outermost wrapping function

Testing

  1. run the following commands
pip install -e .[test]
pytest test/troute-network
pytest test/troute-routing
pytest test/troute-nwm
pytest test/bmi_troute

Screenshots

[root@5b7565ac2de9 t-route]# pytest test/troute-network
======================================================================================================= test session starts ========================================================================================================
platform linux -- Python 3.9.19, pytest-8.3.2, pluggy-1.5.0
rootdir: /t-route
configfile: pyproject.toml
plugins: anyio-4.7.0
collected 1 item                                                                                                                                                                                                                   

test/troute-network/test_hyfeatures_network.py .                                                                                                                                                                             [100%]

========================================================================================================= warnings summary =========================================================================================================
test/troute-network/test_hyfeatures_network.py::test_network
  /opt/venv/lib64/python3.9/site-packages/pandas/core/frame.py:706: DeprecationWarning: Passing a BlockManager to DataFrame is deprecated and will raise in a future version. Use public APIs instead.
    warnings.warn(

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=================================================================================================== 1 passed, 1 warning in 2.82s ===================================================================================================
[root@5b7565ac2de9 t-route]# pytest test/troute-routing
======================================================================================================= test session starts ========================================================================================================
platform linux -- Python 3.9.19, pytest-8.3.2, pluggy-1.5.0
rootdir: /t-route
configfile: pyproject.toml
plugins: anyio-4.7.0
collected 5 items                                                                                                                                                                                                                  

test/troute-routing/test_hyfeature_utils.py ..                                                                                                                                                                               [ 40%]
test/troute-routing/test_nnu_utils.py ...                                                                                                                                                                                    [100%]

========================================================================================================= warnings summary =========================================================================================================
test/troute-routing/test_hyfeature_utils.py::test_assemble_forcings
  /opt/venv/lib64/python3.9/site-packages/pandas/core/frame.py:706: DeprecationWarning: Passing a BlockManager to DataFrame is deprecated and will raise in a future version. Use public APIs instead.
    warnings.warn(

test/troute-routing/test_nnu_utils.py::test_build_nhd_forcing_sets
test/troute-routing/test_nnu_utils.py::test_da_sets
  /opt/venv/lib64/python3.9/site-packages/troute/nhd_network_utilities_v02.py:100: DeprecationWarning: Call to deprecated function (or staticmethod) extract_waterbody_connections. (Functionality moved to Network classes) -- Deprecated since version 2.4.0.
    wbodies = nhd_network.extract_waterbody_connections(

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
================================================================================================== 5 passed, 3 warnings in 5.07s ===================================================================================================
[root@5b7565ac2de9 t-route]# pytest test/troute-nwm
======================================================================================================= test session starts ========================================================================================================
platform linux -- Python 3.9.19, pytest-8.3.2, pluggy-1.5.0
rootdir: /t-route
configfile: pyproject.toml
plugins: anyio-4.7.0
collected 2 items                                                                                                                                                                                                                  

test/troute-nwm/test_nwm_route.py .                                                                                                                                                                                          [ 50%]
test/troute-nwm/test_preprocess.py .                                                                                                                                                                                         [100%]

========================================================================================================= warnings summary =========================================================================================================
test/troute-nwm/test_nwm_route.py::test_nwm_route_execution
test/troute-nwm/test_preprocess.py::test_nhd_preprocess
  /opt/venv/lib64/python3.9/site-packages/troute/nhd_network_utilities_v02.py:100: DeprecationWarning: Call to deprecated function (or staticmethod) extract_waterbody_connections. (Functionality moved to Network classes) -- Deprecated since version 2.4.0.
    wbodies = nhd_network.extract_waterbody_connections(

test/troute-nwm/test_nwm_route.py::test_nwm_route_execution
  /opt/venv/lib64/python3.9/site-packages/pandas/core/frame.py:706: DeprecationWarning: Passing a BlockManager to DataFrame is deprecated and will raise in a future version. Use public APIs instead.
    warnings.warn(

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
================================================================================================== 2 passed, 3 warnings in 20.19s ==================================================================================================
[root@5b7565ac2de9 t-route]# pytest test/troute-bmi
======================================================================================================= test session starts ========================================================================================================
platform linux -- Python 3.9.19, pytest-8.3.2, pluggy-1.5.0
rootdir: /t-route
configfile: pyproject.toml
plugins: anyio-4.7.0
collected 4 items                                                                                                                                                                                                                  

test/troute-bmi/test_bmi.py ....                                                                                                                                                                                             [100%]

========================================================================================================= warnings summary =========================================================================================================
test/troute-bmi/test_bmi.py: 12 warnings
  /opt/venv/lib64/python3.9/site-packages/model_DAforcing.py:586: FutureWarning: 'T' is deprecated and will be removed in a future version, please use 'min' instead.
    df['Datetime'] = pd.date_range(sliceStartTime, periods=df.shape[0], freq=sliceTimeResolutionMinutes+'T')

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
================================================================================================= 4 passed, 12 warnings in 10.39s ==================================================================================================
[root@5b7565ac2de9 t-route]# 

Notes

Todos

Checklist

  • PR has an informative and human-readable title
  • Changes are limited to a single goal (no scope creep)
  • Code can be automatically merged (no conflicts)
  • Code follows project standards (link if applicable)
  • Passes all existing automated tests
  • Any change in functionality is tested
  • New functions are documented (with a description, list of inputs, and expected output)
  • Placeholder code is flagged / future todos are captured in comments
  • Visually tested in supported browsers and devices (see checklist below 👇)
  • Project documentation has been updated (including the "Unreleased" section of the CHANGELOG)
  • Reviewers requested with the Reviewers tool ➡️

Testing checklist

Target Environment support

  • Windows
  • Linux
  • Browser

Accessibility

  • Keyboard friendly
  • Screen reader friendly

Other

  • Is useable without CSS
  • Is useable without JS
  • Flexible from small to large screens
  • No linting errors or warnings
  • JavaScript tests are passing

@taddyb taddyb marked this pull request as ready for review December 17, 2024 22:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant