Skip to content

Pytest enhancements

Kevin Kuns requested to merge kevin.kuns/pygwinc:pytest-enhancements into master

Adds

  1. A pytest marker generate that marks a test as generating test data. These tests will only be run when the --generate flag is given, and all other tests won't be run in this case. This prevents accidentally overwriting test data.
  2. A pytest fixture compare_noise which checks whether all noises in a budget are the same as in another budget. A list of noises passing, failing, or skipped is printed and an assertion error is raised if any traces are different.

The unit tests test_save_budgets and test_check_noise are added to test/budgets/test_budgets.py making use of the new fixture and marker. The compare_noise fixture is useful because it quickly checks if noises are the same and fails if any are different. So you can have pytest both continuously plotting a budget and quickly checking if any noises have changed by doing for example

ptw -- test/budgets/test_budgets.py -s -k test_check_noise
ptw -- test/budgets/test_budgets.py -s -k test_load[Aplus]

Merge request reports