Revert "Merge branch 'dev'"

This reverts commit ac513221a1, reversing
changes made to 2afb5589cd.
This commit is contained in:
2016-01-23 23:47:58 +05:30
parent ac513221a1
commit 3c677ee39f
7 changed files with 129 additions and 10 deletions
@@ -8,7 +8,6 @@ import humanfriendly
import os.path import os.path
from ..utils import s from ..utils import s
from ..utils import REDIS_PORT from ..utils import REDIS_PORT
from PyQt4.QtGui import QApplication
class Controller(htmlPy.Object): class Controller(htmlPy.Object):
+1 -1
View File
@@ -2,7 +2,7 @@
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>{{dir_name}}</title> <title></title>
<style> <style>
* *
{ {
@@ -0,0 +1,112 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<style>
*
{
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
body
{
margin: 2px;
padding: 0;
}
.last-test-statusviz
{
width: 100%;
height: 1.5em;
}
.statusdot
{
height: 100%;
width: 100%;
/*width: 1em;*/
padding: 1px;
float: left;
}
.statusdot-fill
{
width: 100%;
height: 100%;
}
.nostatusdot
{
padding: 1px;
width: 100%;
height: 100%;
background-color: yellow;
}
.fill-pass
{
background-color: green;
}
.fill-fail
{
background-color: red;
}
.last-test-statusviz
{
overflow: hidden;
border: 2px solid black;
}
.last-test-timerelative
{
font-size: 0.75em;
height: 1em;
}
.last-test-dirname
{
font-size: 1em;
text-align: center;
}
</style>
<!-- <script type="text/javascript" src="./refresh.js"></script> -->
<script type="text/javascript">
// debugger
document.onload = setInterval(function(){Controller.redraw()},1000)
</script>
</head>
<body>
<div class="section-last-test">
<!-- <div class="state">
{{ state_desc }}
</div>
<div class="last-test-statusviz">
{% for testname in collect %}
<div class="statusdot statusdot-{{loop.index0}}">
{% if testname in pass %}
<div class="statusdot-fill fill-pass"></div>
{% elif testname in fail %}
<div class="statusdot-fill fill-fail"></div>
{% endif %}
</div>
{% endfor %}
</div>
<div class="last-test-timerelative">
Got {{ last_updated_friendly }} ago
</div> -->
<div class="last-test-dirname">
{{ dir_name_topfolder }}
</div>
<div class="last-test-statusviz">
{% if state == "end" %}
<div class="statusdot statusdot-{{loop.index0}}">
{% if (fail|length) == 0 %}
<div class="statusdot-fill fill-pass"></div>
{% else %}
<div class="statusdot-fill fill-fail"></div>
{% endif %}
</div>
{% else %}
<div class="nostatusdot"></div>
{% endif %}
</div>
</div>
</body>
</html>
+1 -1
View File
@@ -1,12 +1,12 @@
Todo Todo
------ ------
6. Allow config for template
1. test template path available after install 1. test template path available after install
2. test option --show_status_gui available 2. test option --show_status_gui available
3. add details of --show_status_gui in addoption 3. add details of --show_status_gui in addoption
4. Release on pypi 4. Release on pypi
5. Add well-explained readme 5. Add well-explained readme
6. Allow config for template
7. use logging.debug / log file for more prints 7. use logging.debug / log file for more prints
8. Tests with setup/teardown/class when needed 8. Tests with setup/teardown/class when needed
+8 -2
View File
@@ -71,7 +71,7 @@ class Helpers(object):
Helpers.modify_last_updated(dir_name) Helpers.modify_last_updated(dir_name)
@staticmethod @staticmethod
def start_gui(dir_name): def start_gui(dir_name, extra_args=None):
''' '''
Init status_gui at start Init status_gui at start
''' '''
@@ -88,6 +88,9 @@ class Helpers(object):
if not (existing_gui_pid and psutil.pid_exists(existing_gui_pid)): if not (existing_gui_pid and psutil.pid_exists(existing_gui_pid)):
norm_dir_name = os.path.normpath(dir_name) norm_dir_name = os.path.normpath(dir_name)
command_status_gui = command_status_gui_gen.format(norm_dir_name=norm_dir_name) command_status_gui = command_status_gui_gen.format(norm_dir_name=norm_dir_name)
if extra_args:
command_status_gui = command_status_gui + " " + extra_args
# print("Starting gui as: {cmd_gui}".format(cmd_gui=command_status_gui))
gui_popen_obj = subprocess.Popen(command_status_gui) gui_popen_obj = subprocess.Popen(command_status_gui)
gui_pid = gui_popen_obj.pid gui_pid = gui_popen_obj.pid
redis_db.set("{hash_a}_gui_pid".format(hash_a=hash_dir_name), gui_pid) redis_db.set("{hash_a}_gui_pid".format(hash_a=hash_dir_name), gui_pid)
@@ -202,7 +205,8 @@ class PYTEST_DATA(object):
def pytest_addoption(parser): def pytest_addoption(parser):
parser.addoption("--show_status_gui", dest="show_status_gui", action="store_true") parser.addoption("--gui", dest="show_status_gui", action="store_true")
parser.addoption("--gui_minimal", dest="show_status_gui_minimal", action="store_true")
def pytest_configure(config): def pytest_configure(config):
@@ -218,6 +222,8 @@ def pytest_sessionstart(session):
if config.getoption("show_status_gui"): if config.getoption("show_status_gui"):
Helpers.start_gui(PYTEST_DATA.data["dir_name_start"]) Helpers.start_gui(PYTEST_DATA.data["dir_name_start"])
elif config.getoption("show_status_gui_minimal"):
Helpers.start_gui(PYTEST_DATA.data["dir_name_start"], extra_args="--minimal")
def pytest_collectstart(collector): def pytest_collectstart(collector):
+1 -1
View File
@@ -14,7 +14,7 @@ command_redis_server = command_redis_server_gen.format(REDIS_PATH=REDIS_PATH,
REDIS_ARGS=REDIS_ARGS, REDIS_ARGS=REDIS_ARGS,
REDIS_PORT=REDIS_PORT) REDIS_PORT=REDIS_PORT)
command_status_gui_gen = "pytest_gui_status \"{norm_dir_name}\"" command_status_gui_gen = "pytest_gui_status --dir_name=\"{norm_dir_name}\""
def s(input_): def s(input_):
+6 -4
View File
@@ -15,9 +15,9 @@ Pytest Status GUI
Also, install `PySide` and `Redis` manually via apt-get or installers. Also, install `PySide` and `Redis` manually via apt-get or installers.
#### How to use? #### How to use?
`py.test --show_status_gui` `py.test --gui`
**Recommended** : Use with [pytest-watch][ptw_gh_link] using `ptw -- --show_status_gui` **Recommended** : Use with [pytest-watch][ptw_gh_link] using `ptw -- --gui`
pytest-watch re-runs py.test on any change to your code pytest-watch re-runs py.test on any change to your code
@@ -49,11 +49,13 @@ The result is that you get some nifty **test status windows that update as you k
##### Template: ##### Template:
###### Minimal Window: ###### Minimal Window:
//TODO Use `--gui_minimal` instead of `--gui` i.e. call using `py.test --gui_minimal`
The minimal window is closer to what pytddmon does, but is somewhat different. It shows yellow while tests are running or being collected, and only full red or full green bar when tests complete.
###### Use your own template: ###### Use your own template:
//TODO // Not Supported now, maybe I can add if someone needs it.
##### Redis: ##### Redis:
###### Custom Redis Command: ###### Custom Redis Command: