summaryrefslogtreecommitdiff
path: root/test/view-test-results.py
blob: fbc0d7f8871f6fe2748fe5b06a76b45e7ab61ca9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/env python3

import http.server
import os
import threading
import webbrowser

port = 8000

for i in range(10):
    try:
        server = http.server.ThreadingHTTPServer(("localhost", port), http.server.SimpleHTTPRequestHandler)
        break
    except OSError:
        port += 1

thread = threading.Thread(target = server.serve_forever)
thread.daemon = True
thread.start()

webbrowser.open_new("http://localhost:" + str(port) + "/index.html")
input("\nPress Enter to exit\n\n")