EcohydrologyTeam / ClearWater-modules

A collection of water quality and vegetation process simulation modules designed to couple with water transport models.
MIT License
5 stars 1 forks source link

Automatic testing -> some needs from others #8

Closed xaviernogueira closed 1 year ago

xaviernogueira commented 1 year ago

Hi all.

I'm going to set up automatic testing on pull requests to main using pytest. That said, there are two things that need to happen before that:

  1. Choose a packaging / dependencies method - miniconda -> conda-build, poetry (pyproject.toml), classic pip/setuptools (pyproject.toml). @aufdenkampe thoughts?
  2. Merge all your tests to the main branch after formatting to the following pattern @kewalak @imscw95

/tests- (should hold ONLY python files that start with "test_"), ideally tests should be numbered, i.e., "test_1_TSM.py". tests/data - any test data needed to run the tests.

There are multiple unit test codes hidden in various folders of src. All these should be moved to test! src should contain nothing but source code.

With that structure, I can do the rest, and will document the process so everyone can learn. If your branches are conflicting, maybe just PR what you have and I can do the formatting.

aufdenkampe commented 1 year ago

@xaviernogueira, it looks like @kewalak added test files yesterday with commit 69343a5. She sent an email with these notes:

The test files are found within the src/NSM1 folder and are titled _test_module. In each of the test scripts all the variables are defined initially in dictionaries and then within each test case functions one or two of the variables were assigned new values. The initial values and values changed I based off numbers from the documentation (if they had default/range values) but for the most part I just chose numbers that I thought could be appropriate. Each test module script I would run manually. Please let me know if you have any questions!

Can you git mv those new files and any other relevant to the appropriate folder (and rename) to follow those pytest conventions you mentioned?

aufdenkampe commented 1 year ago

@xaviernogueira, Let’s split up this automated testing effort into three tasks/issues:

  1. Restructure repo following pytest conventions
  2. Developing pytest code that can be triggered manually
  3. Developing GitHub Actions to trigger pytest automatically with a PR to main

Can you create those issues?

imscw95 commented 1 year ago

Hello, I reorganized the TSM module and tests in a way that I think satisfies this task. Let me know if you see any issues.

xaviernogueira commented 1 year ago

@imscw95 thanks! Your commit looks good to me. @aufdenkampe I'm on it, issues on the way.

Closing this one.