HomeFreeBSD

testing: allow custom test cleanup handlers in pytest

Description

testing: allow custom test cleanup handlers in pytest

In order to provide more flexibility for the test writers,
add per-test-method cleanups in addition to the per-class cleanups.

Now the test 'test_one' can perform cleanup by either defining
per-class 'cleanup' method (typically used in VNET classes) and
per-test method 'cleanup_test_one'. The latter has preference.
In order to handle paramatrization, testid is passed as a single
argument to both of the methods.

MFC after: 2 weeks

(cherry picked from commit 89ffac3b01fb3f6749799ac67b7d94056a36778e)

Details

Provenance
melifaroAuthored on Dec 31 2022, 4:22 PM
Parents
rG2419f06beb88: testing: improve python vnet wrapper.
Branches
Unknown
Tags
Unknown