lifewatch / pypam

Python Passive Acoustic Analysis tool for Passive Acoustic Monitoring (PAM)
GNU General Public License v3.0
41 stars 8 forks source link

some suggested adjustments for unit tests #8

Closed carueda closed 1 year ago

carueda commented 1 year ago

Hi @cparcerisas - In a first commit here, I'm just using test_utils as a basis for suggesting some adjustments and possible next steps that could be considered also for other units tests. (PR mainly for discussion purposes at this point ; )

With the adjustments above, one can then run this particular test, including the plots, from the root as follows:

$ python -m unittest tests.test_utils

or with $ python tests/test_utils.py given the __main__ section in the file.

And, without generating the plots:

$ PYPAM_TEST_NO_PLOTS= python -m unittest tests.test_utils
..
----------------------------------------------------------------------
Ran 2 tests in 0.518s

OK

What do you think?

cparcerisas commented 1 year ago

Hi @carueda thanks for the effort! Looks good to me, should we do it for all the tests before merging into master?

carueda commented 1 year ago

Great, thank @cparcerisas. For all unit tests, I've just pushed a commit with the tests/ prefix for the data location and with the skipping of plotting if the env var PYPAM_TEST_NO_PLOTS is defined.

At this point, the complete unit testing behaves as in master (with some failures basically as reported here). I'll try to look into them more closely as well as create an initial GitHub CI workflow.

carueda commented 1 year ago

I've added a CI workflow here but will be refining it in a separate branch.

carueda commented 1 year ago

CI workflow in place, only for python 3.9 while we can fix the pending tests (which, as already mentioned, are failing both in current master and in this PR's branch).

https://github.com/mbari-org/pypam/actions/runs/3679242090

carueda commented 1 year ago

@cparcerisas I'm marking this a ready for your review/merge as the changes basically address the title of this PR ;)

I looked at the failing tests and felt not very confident about proceeding with any attempted fixes at this point, so we could look at those in subsequent PRs. Ok?

carueda commented 1 year ago

Thanks @cparcerisas !