Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jopohl committed Mar 27, 2017
1 parent 904048f commit 83c6499
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions tests/debug_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,27 @@
import time

RUNS = 2000
LOG_SIZE_MB = 1


os.system("mkdir -p /tmp/tests")

streak = 0
longest_streak = 0

for i in range(RUNS):
try:
time.sleep(0.1)
filename = "/tmp/tests/" + str(datetime.datetime.now()).replace(" ", "-")
t = time.time()
completed = subprocess.run("pytest -s -v ../tests", shell=True, stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)

duration = time.time() - t
if completed.returncode == 0:
streak += 1
longest_streak = max(streak, longest_streak)
print("#{} was successful [{:.2f}s] (Streak: {}/{})".format(i + 1, time.time() - t, streak, longest_streak))
print("#{} was successful [{:.2f}s] (Streak: {}/{})".format(i + 1, duration, streak, longest_streak))
else:
streak = 0
print("#{} failed [{:.2f}s]".format(i + 1, time.time() - t))
print("#{} failed [{:.2f}s]".format(i + 1, duration))
with open(filename, "wb") as f:
f.write(completed.stdout[-LOG_SIZE_MB * 1024 * 1024:])
f.write(completed.stdout)
print("Written output to file {}".format(filename))
except KeyboardInterrupt:
sys.exit(1)

0 comments on commit 83c6499

Please sign in to comment.