Last active
August 10, 2019 11:21
-
-
Save Andrei-Pozolotin/f9b01dfd1bec94523ed73a5c9f16ec3d to your computer and use it in GitHub Desktop.
brython #1182
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://github.com/brython-dev/brython/issues/1182 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
brython.js:8724 GET http://127.0.0.1:5000/import/healer_test.js?v=1565436011947 404 (NOT FOUND) | |
brython.js:8729 Error 404 means that Python module healer_test was not found at url /import/healer_test.js | |
brython.js:8724 GET http://127.0.0.1:5000/import/healer_test.pyc.js?v=1565436011958 404 (NOT FOUND) | |
brython.js:8729 Error 404 means that Python module healer_test was not found at url /import/healer_test.pyc.js | |
brython.js:8724 GET http://127.0.0.1:5000/import/healer_test/__init__.pyc.js?v=1565436011967 404 (NOT FOUND) | |
brython.js:8729 Error 404 means that Python module healer_test was not found at url /import/healer_test/__init__.pyc.js | |
brython.js:8724 GET http://127.0.0.1:5000/import/healer_test.py?v=1565436011975 404 (NOT FOUND) | |
brython.js:8729 Error 404 means that Python module healer_test was not found at url /import/healer_test.py | |
brython.js:8724 GET http://127.0.0.1:5000/import/healer_test/station.py?v=1565436011997 404 (NOT FOUND) | |
brython.js:8729 Error 404 means that Python module healer_test.station was not found at url /import/healer_test/station.py | |
brython.js:8724 GET http://127.0.0.1:5000/import/healer_test/station/base.py?v=1565436012021 404 (NOT FOUND) | |
brython.js:8729 Error 404 means that Python module healer_test.station.base was not found at url /import/healer_test/station/base.py | |
brython.js:8724 GET http://127.0.0.1:5000/import/healer.py?v=1565436012060 404 (NOT FOUND) | |
brython.js:8729 Error 404 means that Python module healer was not found at url /import/healer.py | |
brython.js:8724 GET http://127.0.0.1:5000/import/healer/station.py?v=1565436012083 404 (NOT FOUND) | |
brython.js:8729 Error 404 means that Python module healer.station was not found at url /import/healer/station.py | |
brython.js:8724 GET http://127.0.0.1:5000/import/healer/station/base.py?v=1565436012104 404 (NOT FOUND) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | |
<link rel="icon" href="/static/favicon.ico"> | |
<link rel="stylesheet" type="text/css" href="/web_bootstrap/css/bootstrap.css" > | |
</head> | |
<body onload="brython({ debug:1, pythonpath:[ '/import' ] })"> | |
<main class="container"> | |
<div id="report_head"></div> | |
<div id="report_body"></div> | |
</main> | |
<script type="text/javascript" src="/web_jquery/jquery.js"></script> | |
<script type="text/javascript" src="/web_popper/umd/popper.js"></script> | |
<script type="text/javascript" src="/web_bootstrap/js/bootstrap.js"></script> | |
<script type="text/javascript" src="/web_vue/vue.js"></script> | |
<script type="text/javascript" src="/web_vue_router/vue-router.js"></script> | |
<script type="text/javascript" src="/brython/brython.js"></script> | |
<script type="text/python" src="/client_test/runtime.py"></script> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Invoke tests in browser | |
""" | |
from healer_test.station.base.arkon_test import * | |
from browser import document | |
from browser.html import DIV | |
from javascript import Date | |
report_head = document['report_head'] | |
report_body = document['report_body'] | |
report_head.classList = ['container-fluid'] | |
report_head.style = {'background-color': 'beige'} | |
report_body.classList = ['container-fluid'] | |
report_success = DIV('success', style={'color':'green'}) | |
report_failure = DIV('failure', style={'color':'brown'}) | |
report_head <= report_success | |
report_head <= report_failure | |
class count_test: | |
success = 0 | |
failure = 0 | |
def invoke_test(test_func): | |
test_name = test_func.__name__ | |
record = DIV(Class='row') | |
report_body <= record | |
record <= DIV(test_name, Class='col-sm-3') | |
print(f"{test_name}: ") | |
try: | |
time_start = Date.new() | |
test_func() | |
time_finish = Date.new() | |
message = 'success' | |
print(message) | |
record <= DIV(message, style={'color':'green'}, Class='col-sm-3') | |
count_test.success += 1 | |
except Exception as error: | |
time_finish = Date.new() | |
message = f'failure: {error}' | |
print(message) | |
record <= DIV(message, style={'color':'brown'}, Class='col-sm-3') | |
count_test.failure += 1 | |
time_diff = time_finish.getTime() - time_start.getTime() | |
message = f"{time_diff} ms" | |
record <= DIV(message, Class='col-sm-3') | |
report_success.text = f'success: {count_test.success}' | |
report_failure.text = f'failure: {count_test.failure}' | |
globals_dict = globals().copy() | |
for test_name in globals_dict: | |
if test_name.startswith("test_"): | |
test_func = globals_dict[test_name] | |
invoke_test(test_func) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment