Skip to content

Commit

Permalink
TST Don't print python traceback in pytest_wrapper (pyodide#1103)
Browse files Browse the repository at this point in the history
  • Loading branch information
dalcde authored Jan 12, 2021
1 parent cf7cbd4 commit e4c4702
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions tools/pytest_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,21 @@ def clean_args(args: List[str]) -> None:
if __name__ == "__main__":
try:
subprocess.run(["pytest"] + args, check=True)
sys.exit(0)
except subprocess.CalledProcessError:
# Failed tests. Look up number of failed tests
with open(".pytest_cache/v/cache/lastfailed") as f:
num_failed = sum(1 for line in f) - 2

if num_failed < 10:
print("Rerunnning failed tests sequentially")
clean_args(args)
subprocess.run(["pytest", "--lf"] + args, check=True)
else:
print("More than 9 tests failed. Not rerunning")
raise
pass

# Failed tests. Look up number of failed tests
with open(".pytest_cache/v/cache/lastfailed") as f:
num_failed = sum(1 for line in f) - 2

if num_failed > 9:
print("More than 9 tests failed. Not rerunning")
sys.exit(1)

print("Rerunnning failed tests sequentially")
clean_args(args)
try:
subprocess.run(["pytest", "--lf"] + args, check=True)
except subprocess.CalledProcessError:
sys.exit(1)

0 comments on commit e4c4702

Please sign in to comment.