Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add unit test framework #32

Open
cmovic opened this issue Jan 30, 2024 · 1 comment
Open

Add unit test framework #32

cmovic opened this issue Jan 30, 2024 · 1 comment

Comments

@cmovic
Copy link
Contributor

cmovic commented Jan 30, 2024

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.

@cmovic
Copy link
Contributor Author

cmovic commented Feb 15, 2024

#37 - further changes that eliminate the floating point equality checks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant