benchexec icon indicating copy to clipboard operation
benchexec copied to clipboard

Draft: Add a Pytest-based Testsuite

Open schroeding opened this issue 9 months ago • 2 comments

This branch introduces a second testsuite, using pytest, in addition to the existing nose-based testsuite. The goal is to migrate the current testsuite to pytest, making it obsolete (see Issue 162).

Note that, if we want to use pytest features like test function parameterization (i.e. using a pytest decorator instead of having helper methods, which call another test method multiple times with different parameters), the new testsuite will have a larger number of tests - nose sees e.g. a helper method which calls the actual test with 4 different parameter combinations and assert statements as a single test, pytest will report it as 4 tests.

Short feedback if we want to use pytest parameterization or just translate the current tests as they are with as few changes as possible would be appreciated. For an example how the tests would be rewritten, see e.g. commit dad90346f320a2447b2dd1d91a15c3a3e3342a18.

Upside would be that any failing call to a test method, which currently is hidden inside helper methods, would be directly reported by pytest without having to check manually which assertion failed, i.e. tests would be finer. Would also clearly separate the test data from the actual tests. Downside would be the need to rewrite significant parts of the testsuite and that there wouldn't be a 1:1 relation between the current and new testsuite, but a 1:n relation.

schroeding avatar May 06 '24 18:05 schroeding

Short feedback if we want to use pytest parameterization or just translate the current tests as they are with as few changes as possible would be appreciated.

Your discussion of this question is fully correct. If parameterized tests are now easy, we would like to have their advantages.

I would, however, tend to say this should be a two-step process: First migrate to pytest with the existing pattern of tests, and afterwards improve the tests to be parameterized. This would have the advantage of making the first step less complex and make it easier to compare the number of tests during the migration and to review the changes.

PhilippWendler avatar May 07 '24 04:05 PhilippWendler

Can you please use a branch in this repository and not a fork? Only this way you get CI that executes the tests.

PhilippWendler avatar May 07 '24 04:05 PhilippWendler