PAHdb / pyPAHdb

A Python tool to decompose astronomical PAH emission into contributing PAH subclasses.
https://www.astrochemistry.org/pahdb/
BSD 3-Clause "New" or "Revised" License
7 stars 6 forks source link

Improve test coverage #11

Closed mattjshannon closed 6 years ago

mattjshannon commented 6 years ago

Unit tests need some TLC, particularly the decomposer.py and decomposer_base.py modules.

PAHdb commented 6 years ago

The coverage report generated by Travis does not only include the coverage of pypahdb, but also of pytest and all its dependencies. Adding --source pypahdb to the coverage command fixes this. [update] It looks like the coverage is the same, but Travis is quicker in generating the number.

mattjshannon commented 6 years ago

Apparently we can consolidate our fixtures and place them in conftest.py, which will make them available (automatically) to all of the test_*.py files. Neat!

Refs: https://stackoverflow.com/questions/34466027/in-py-test-what-is-the-use-of-conftest-py-files https://docs.pytest.org/en/latest/fixture.html#conftest-py-sharing-fixture-functions

PAHdb commented 6 years ago

Currently the tests are making use of unittests, which does not work well with pytests' fixtures. Since unittests uses classes, commonality between tests can be captured in class properties.

Test coverage is now above 80%, which should be sufficient for know.