brendanjmeade / celeri

Next generation earthquake cycle kinematics
BSD 3-Clause "New" or "Revised" License
24 stars 6 forks source link

All tests failing but celeri runs fine locally??? #40

Closed brendanjmeade closed 2 years ago

brendanjmeade commented 2 years ago

I added a few lines (118, 119, and 120) to celeri to add a few more fields to the dictionary meshes after it reads in data from the .json file that describes the meshes. I get the error below reporting a failure related to the assignement of one of these variables...but...the entire thing runs just fine locally on my laptop? I'm pretty confused. Thoughts @tbenthompson?

=================================== FAILURES =================================== _____ test_global_closure __ celeri.py:2184: in test_global_closure command, segment, block, meshes, station, mogi, sar = celeri.read_data( celeri.py:118: in read_data meshes[i].smoothing_weight = mesh_param[i]["smoothing_weight"] E KeyError: 'smoothing_weight' =========================== short test summary info ============================ FAILED celeri.py::test_global_closure - KeyError: 'smoothing_weight' ========================= 1 failed, 2 passed in 17.71s =========================

tbenthompson commented 2 years ago

I got exactly the same error when running locally. When you tested locally, how were you running the code? To exactly replicate the CI system, you need to run pytest celeri.py celeri_closure.py (see this file for a definition of exactly what the CI runs): https://github.com/brendanjmeade/celeri/blob/37c8f8cd1aed1fcd412fccdcc86bfd44da1a1130/.github/workflows/test.yml#L28

I just created https://github.com/brendanjmeade/celeri/pull/41 to fix the issue!

brendanjmeade commented 2 years ago

Running pytest locally will help me a lot. Thanks a lot not only for the fix but more importantly for your patience in teaching me how to listen and learn from the testing results!

tbenthompson commented 2 years ago

Of course! Happy to help.

The "short test summary info" is often the place to start:

FAILED celeri.py::test_global_closure - KeyError: 'smoothing_weight'

tells you that the test that failed was the test_global_closure test in celeri.py.

You can run just a specific test using that same syntax:

pytest celeri.py::test_global_closure
brendanjmeade commented 2 years ago

That helps a lot. Good to be learning!