Add unit test framework
cmovic opened this issue · comments
Hi, I'm Vic. I'd like to contribute to the fplan
project but I'm deathly afraid of breaking something. I think adding a unit test framework and some simple tests is a start toward building up a robust test environment where I and others will feel more comfortable making changes and having some knowledge that the wheels aren't coming off the train.
I've got experience with pytest
so that's an easy place to start. I'm open to other testing frameworks but hope to keep this change simple.
I'm proposing that we create a test
top level directory and that it mirrors src
and looks something like this:
$ ls -R src test
src:
fplan
src/fplan:
fplan.py
test:
fplan
test/fplan:
test_load_file
test/fplan/test_load_file:
test1.toml test_load_file.py
pytest
runs everything named test_*.py
and *_test.py
so the test source files can be simple and isolated from each other. There can be multiple directories in test/fplan
for specific tests and their data. The example above contains some simple tests for the Data
class load_file()
function. Adding some solver tests seems like an obvious next step. Repeat as necessary until we have good coverage.
#37 - further changes that eliminate the floating point equality checks.