Commit 3762dbf3 authored by Dom Sekotill's avatar Dom Sekotill
Browse files

Print coverage report even if SystemExit is not rasied

`unittest` appears to no longer be raising SystemExit on completion.
parent b4eeca72
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -95,7 +95,7 @@ def coverage_report(modules, include=None, exclude=None, file=None):

	try:
		yield
	except (SystemExit):
	finally:
		modules = {sys.modules.get(m.__name__) for m in modules}
		modules.discard(None)

@@ -108,8 +108,6 @@ def coverage_report(modules, include=None, exclude=None, file=None):
				file.write("\nCoverage Report:\n================\n")
			cover.report(list(modules), include=include, omit=exclude, file=file)

		raise
	finally:
		sys.modules.clear()
		sys.modules.update(old_modules)