tests/conftest: Reset global state between test runs
Restore previous tests behavior before the pytest migration.
Also use a cleaner way to initialize tests data through a pytest fixture
and cleanup implementation (no more global variables use).
Related to T2062