mirror of
https://github.com/bendtherules/pytest_gui_status.git
synced 2026-08-18 13:42:26 +00:00
Move loading options from env code to utils
This commit is contained in:
@@ -7,13 +7,7 @@ from datetime import datetime
|
||||
import humanfriendly
|
||||
import os.path
|
||||
from ..utils import s
|
||||
|
||||
|
||||
env_redis_port = os.environ.get("PYTEST_STATUS_PORT")
|
||||
if env_redis_port:
|
||||
REDIS_PORT = int(env_redis_port)
|
||||
else:
|
||||
REDIS_PORT = 5946
|
||||
from ..utils import REDIS_PORT
|
||||
|
||||
|
||||
class Controller(htmlPy.Object):
|
||||
|
||||
@@ -31,7 +31,7 @@ Done
|
||||
11. (---) Use travis ci + install redis there
|
||||
12. (---) Show gui only with option --status_gui
|
||||
13. (---) env config for redis + test for that
|
||||
14. (---) Use redis_db fixture for travis debugging (---)
|
||||
14. (---) Use redis_db fixture for travis debuggings
|
||||
|
||||
|
||||
Think
|
||||
|
||||
@@ -7,23 +7,7 @@ import os
|
||||
import psutil
|
||||
import datetime
|
||||
from ..utils import s
|
||||
|
||||
|
||||
env_redis_port = os.environ.get("PYTEST_STATUS_PORT")
|
||||
if env_redis_port:
|
||||
REDIS_PORT = int(env_redis_port)
|
||||
else:
|
||||
REDIS_PORT = 5946
|
||||
|
||||
REDIS_PATH = os.environ.get("REDIS_PATH") or "redis-server"
|
||||
REDIS_ARGS = os.environ.get("REDIS_ARGS") or ""
|
||||
|
||||
command_redis_server_gen = "{REDIS_PATH} --port {REDIS_PORT} {REDIS_ARGS}"
|
||||
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}\""
|
||||
from ..utils import REDIS_PORT, command_redis_server, command_status_gui_gen
|
||||
|
||||
# Redis will look like:
|
||||
# PYTEST_STATUS_DB = 1
|
||||
|
||||
@@ -1,3 +1,22 @@
|
||||
import os
|
||||
|
||||
env_redis_port = os.environ.get("PYTEST_STATUS_PORT")
|
||||
if env_redis_port:
|
||||
REDIS_PORT = int(env_redis_port)
|
||||
else:
|
||||
REDIS_PORT = 5946
|
||||
|
||||
REDIS_PATH = os.environ.get("REDIS_PATH") or "redis-server"
|
||||
REDIS_ARGS = os.environ.get("REDIS_ARGS") or ""
|
||||
|
||||
command_redis_server_gen = "{REDIS_PATH} --port {REDIS_PORT} {REDIS_ARGS}"
|
||||
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}\""
|
||||
|
||||
|
||||
def s(input_):
|
||||
''' Convert str or uncode or bytes to str.
|
||||
If list, do it for all of them.
|
||||
|
||||
Reference in New Issue
Block a user