ansible-test - Fix unit test coverage collection (#83433)

pull/83437/head
Matt Clay 6 months ago committed by GitHub
parent 72a5957720
commit 738180d240
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -53,6 +53,12 @@ def pytest_configure():
def coverage_exit(*args, **kwargs): def coverage_exit(*args, **kwargs):
for instance in coverage_instances: for instance in coverage_instances:
# skip coverage instances which have no collector, or the collector is not the active collector
# this avoids issues with coverage 7.4.0+ when tests create subprocesses which inherit our overridden os._exit method
# pylint: disable=protected-access
if not instance._collector or not instance._collector._collectors or instance._collector != instance._collector._collectors[-1]:
continue
instance.stop() instance.stop()
instance.save() instance.save()

Loading…
Cancel
Save