Support .coveragerc file

This commit is contained in:
GuillaumeCisco
2019-03-12 17:57:29 +01:00
committed by Dmitry Trofimov
parent bfede40012
commit 02b559eed0
@@ -46,14 +46,19 @@ sys.argv = argv
cwd = os.getcwd()
run_xml = os.getenv('PYCHARM_RUN_COVERAGE_XML')
argv = ["xml", "-o", coverage_file + ".xml", "--ignore-errors"]
rcfile = cwd + "/.coveragerc"
if os.path.exists(rcfile):
print("Loading rcfile: %s\n" % rcfile)
argv += ["--rcfile", rcfile]
if run_xml:
os.chdir(cwd)
main(["xml", "-o", coverage_file + ".xml", "--ignore-errors"])
main(argv)
else:
try:
main()
finally:
if run_cov:
os.chdir(cwd)
main(["xml", "-o", coverage_file + ".xml", "--ignore-errors"])
main(argv)