This makes it possible to run tests that do not require physical devices under pytest. These tests will now function under pytest:
eeprom_mock
gpio
mockusb
In addition, one non-device-requiring test already functioned properly under pytest:
toolsimport
Two main changes are made:
In the three tests, environment setup (mostly to establish the virtual device mock) now happens in setup_module instead of main. pytest does not run main, but will run setup_module. This was done without breaking any compatibility with existing test environments by making main call setup_module.
In eeprom_mock, the inheritance model is changed slightly to avoid pytest discovering and running tests in untestable base classes. These tests are not able to run in the base classes and wind up producing errors, because they depend on variables only validly set in subclasses.
This makes it possible to run tests that do not require physical devices under pytest. These tests will now function under pytest:
Two main changes are made:
setup_module
instead ofmain
. pytest does not runmain
, but will runsetup_module
. This was done without breaking any compatibility with existing test environments by makingmain
callsetup_module
.