Marker inheritance and non-parametrised tests with solver dependency#961
Marker inheritance and non-parametrised tests with solver dependency#961ThomSerg wants to merge 3 commits into
Conversation
|
I would say the second is preferred, it allows for more dynamically adding more solvers to the tests (as done in #950). |
|
But the test is named |
|
Well yes, the test is also renamed to be general in #950. I don't think it makes sense to make a new class for each solver, instead of just adding the solver to the list of required solvers. I think this also makes more sense in general for other tests in the future. |
OrestisLomis
left a comment
There was a problem hiding this comment.
I don't think this really works actually. If I put an assert False in the first line of CPM_Exact.mus_native() then the test suite does not actually catch this. So the tests are still not run. Even if I put solver as an argument in the class. Please have another look when you have some time.
|
I now added support for solver dependent tests that aren't parametrised. When you have a test that is really specific to only one solver, it's a bit dubious to then be required to parametrise it with argument "solver" to be able to use the marker |
The build-in helpers of PyTest giving easy access to the markers all seem to merge markers when working with inheritance; a subclass also gets the markers from its superclass, even if marker had been redeclared. So had to more directly access the pytestmark on the bare class.
Additionally had to add skipping logic for tests that have a solver dependency but that do not actually take a
solverargument as input (i.e. solver argument is hard-coded).An alternative (that does not require added skip logic):
So only a question about which of the above two is preferred.