clawpack / classic

Classic single-grid Fortran routines
http://www.clawpack.org
BSD 3-Clause "New" or "Revised" License
11 stars 25 forks source link

WIP: Using pytest instead of nose requires renaming to regression_test.py #90

Closed rjleveque closed 3 months ago

rjleveque commented 1 year ago

After changing regression_tests.py to regression_test.py, using pytest seems to work fine.

It gave some warnings:

% pytest
=============================== warnings summary ===============================
../../../pyclaw/src/pyclaw/classic/solver.py:16
  /Users/rjl/git/clawpack/pyclaw/src/pyclaw/classic/solver.py:16: DeprecationWarning: the imp module is deprecated in favour of importlib and slated for removal in Python 3.12; see the module's documentation for alternative uses
    from imp import reload

classic/tests/acoustics_3d_heterogeneous/regression_test.py::Acoustics3DHeterogeneousTest::runTest
  <frozen importlib._bootstrap>:241: RuntimeWarning: numpy.ndarray size changed, may indicate binary incompatibility. Expected 16 from C header, got 96 from PyObject

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
======================== 1 passed, 2 warnings in 3.70s =========================

The first is fixed in https://github.com/clawpack/pyclaw/pull/701.

I don't know what's up with the numpy warning.

@mandli, @ketch: We should discuss further before merging this to make sure pytest is what we want to use.

ketch commented 1 year ago

Answers here suggest that updating numpy may get rid of the second warning:

https://stackoverflow.com/questions/66060487/valueerror-numpy-ndarray-size-changed-may-indicate-binary-incompatibility-exp

I'm using numpy version 1.25.1 and I'm able to run the tests (using pytest) without getting that warning.

However, it should be noted that this still depends on nose (see line 32 of regression_test.py). If you uninstall nose, the tests won't run.

rjleveque commented 1 year ago

Thanks @ketch, but it does not look like the @wip is used anywhere so I tried to clean this up in https://github.com/clawpack/clawutil/pull/155

rjleveque commented 3 months ago

Merging this so we can test github CI