Unit tests have an excessive amount of repeated test setup code, making unit tests harder to maintain and read. Better use of pytest fixtures to setup each test would remove needless code repetition.
Tests are also organised where each function func has a test function test_func. To get better use out of pytest fixtures, we should organise the tests so that for each function func, we have a test class TestFunc with each method of TestFunc containing a single test (success or failure case). This also prevents the possibility of state leaking into each test case.
Unit tests have an excessive amount of repeated test setup code, making unit tests harder to maintain and read. Better use of pytest fixtures to setup each test would remove needless code repetition.
Tests are also organised where each function
func
has a test functiontest_func
. To get better use out of pytest fixtures, we should organise the tests so that for each functionfunc
, we have a test classTestFunc
with each method ofTestFunc
containing a single test (success or failure case). This also prevents the possibility of state leaking into each test case.