From 3c677ee39f18de274ee7194588687f644dc6ef90 Mon Sep 17 00:00:00 2001 From: Abhas Bhattacharya Date: Sat, 23 Jan 2016 23:47:58 +0530 Subject: [PATCH] Revert "Merge branch 'dev'" This reverts commit ac513221a1d77d44c89ab0fdc5147908aec62cb2, reversing changes made to 2afb5589cd6899e34c117c19127032e9e79be136. --- pytest_gui_status/status_gui/gui_backend.py | 1 - pytest_gui_status/status_gui/tmpl/index.html | 2 +- .../status_gui/tmpl/minimal.html | 112 ++++++++++++++++++ pytest_gui_status/status_gui/todo.txt | 2 +- pytest_gui_status/status_plugin/plugin.py | 10 +- pytest_gui_status/utils.py | 2 +- readme.md | 10 +- 7 files changed, 129 insertions(+), 10 deletions(-) create mode 100644 pytest_gui_status/status_gui/tmpl/minimal.html diff --git a/pytest_gui_status/status_gui/gui_backend.py b/pytest_gui_status/status_gui/gui_backend.py index db885b6..597787d 100644 --- a/pytest_gui_status/status_gui/gui_backend.py +++ b/pytest_gui_status/status_gui/gui_backend.py @@ -8,7 +8,6 @@ import humanfriendly import os.path from ..utils import s from ..utils import REDIS_PORT -from PyQt4.QtGui import QApplication class Controller(htmlPy.Object): diff --git a/pytest_gui_status/status_gui/tmpl/index.html b/pytest_gui_status/status_gui/tmpl/index.html index d0722dd..6762b7f 100644 --- a/pytest_gui_status/status_gui/tmpl/index.html +++ b/pytest_gui_status/status_gui/tmpl/index.html @@ -2,7 +2,7 @@ - {{dir_name}} + + + + + +
+ +
+ {{ dir_name_topfolder }} +
+
+ {% if state == "end" %} +
+ {% if (fail|length) == 0 %} +
+ {% else %} +
+ {% endif %} +
+ {% else %} +
+ {% endif %} +
+
+ + diff --git a/pytest_gui_status/status_gui/todo.txt b/pytest_gui_status/status_gui/todo.txt index d613a3c..97a7a1e 100644 --- a/pytest_gui_status/status_gui/todo.txt +++ b/pytest_gui_status/status_gui/todo.txt @@ -1,12 +1,12 @@ Todo ------ +6. Allow config for template 1. test template path available after install 2. test option --show_status_gui available 3. add details of --show_status_gui in addoption 4. Release on pypi 5. Add well-explained readme -6. Allow config for template 7. use logging.debug / log file for more prints 8. Tests with setup/teardown/class when needed diff --git a/pytest_gui_status/status_plugin/plugin.py b/pytest_gui_status/status_plugin/plugin.py index 5a2ef71..018eac9 100644 --- a/pytest_gui_status/status_plugin/plugin.py +++ b/pytest_gui_status/status_plugin/plugin.py @@ -71,7 +71,7 @@ class Helpers(object): Helpers.modify_last_updated(dir_name) @staticmethod - def start_gui(dir_name): + def start_gui(dir_name, extra_args=None): ''' Init status_gui at start ''' @@ -88,6 +88,9 @@ class Helpers(object): if not (existing_gui_pid and psutil.pid_exists(existing_gui_pid)): norm_dir_name = os.path.normpath(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_pid = gui_popen_obj.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): - 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): @@ -218,6 +222,8 @@ def pytest_sessionstart(session): if config.getoption("show_status_gui"): 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): diff --git a/pytest_gui_status/utils.py b/pytest_gui_status/utils.py index f13dfe4..b27be48 100644 --- a/pytest_gui_status/utils.py +++ b/pytest_gui_status/utils.py @@ -14,7 +14,7 @@ command_redis_server = command_redis_server_gen.format(REDIS_PATH=REDIS_PATH, REDIS_ARGS=REDIS_ARGS, 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_): diff --git a/readme.md b/readme.md index b34f39e..b95dd15 100644 --- a/readme.md +++ b/readme.md @@ -15,9 +15,9 @@ Pytest Status GUI Also, install `PySide` and `Redis` manually via apt-get or installers. #### 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 @@ -49,11 +49,13 @@ The result is that you get some nifty **test status windows that update as you k ##### Template: ###### 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: -//TODO +// Not Supported now, maybe I can add if someone needs it. ##### Redis: ###### Custom Redis Command: