From 11722f1f5ed2d4dea781c74a4be1be0cb7d03646 Mon Sep 17 00:00:00 2001 From: Johannes Bechberger Date: Sat, 29 Oct 2016 21:50:06 +0200 Subject: [PATCH] Add missing required package to setup.py --- README.mdwn | 9 +++++---- mjtest/cli.py | 15 ++++++++++----- mjtest/environment.py | 5 ++--- setup.py | 3 ++- 4 files changed, 19 insertions(+), 13 deletions(-) diff --git a/README.mdwn b/README.mdwn index 4da65cf..2b559a0 100644 --- a/README.mdwn +++ b/README.mdwn @@ -63,15 +63,16 @@ Output of the `mjtest --help` ``` usage: mjtest [-h] [--tmp_dir] [--test_dir] [--only_incorrect_tests] [--parallel] [--timeout] [--report_dir] [--log LOG] - {syntax,semantic,exec} MJ_RUN_CMD + {syntax,semantic,exec} MJ_RUN MiniJava test runner positional arguments: {syntax,semantic,exec} What do you want to test? - MJ_RUN_CMD Command to run your MiniJava implementation, e.g. - `mj/run` + MJ_RUN Command to run your MiniJava implementation, e.g. + `mj/run`, can be omitted by assigning the environment + variable MJ_RUN optional arguments: -h, --help show this help message and exit @@ -90,7 +91,7 @@ optional arguments: ### Example usage Assuming you want to run the syntax tests and your MiniJava base folder is `~/code/mj` then run ``` -mjtest syntax ~/code/mj/run --lextest +MJ_RUN="~/code/mj/run" mjtest syntax ``` This will… - … create reports in a folder named after the current date and time inside the `reports` folder diff --git a/mjtest/cli.py b/mjtest/cli.py index 6cfe507..7b9ff58 100644 --- a/mjtest/cli.py +++ b/mjtest/cli.py @@ -1,4 +1,5 @@ import logging +import os from pprint import pprint import sys import mjtest.util.utils @@ -26,9 +27,11 @@ if True:#__name__ == '__main__': parser.add_argument("mode", choices=TEST_MODES, help="What do you want to test?") - parser.add_argument("mj_run_cmd", - metavar="MJ_RUN_CMD", - help="Command to run your MiniJava implementation, e.g. `mj/run`") + if os.getenv("MJ_RUN", None) is None: + parser.add_argument("mj_run", + metavar="MJ_RUN", + help="Command to run your MiniJava implementation, e.g. `mj/run`, " + "can be omitted by assigning the environment variable MJ_RUN") parser.add_argument("--tmp_dir", action="store_const", default="", const="tmp_dir", help="Used temporary directory") parser.add_argument("--test_dir", action="store_const", default="", const="test_dir", @@ -43,8 +46,10 @@ if True:#__name__ == '__main__': help="Directory to store the reports in, default is 'reports'") parser.add_argument("--log_level", action=LogLevelChoices, default="warn", const="log_level", help="Logging level (error, warn, info or debug)") - args = parser.parse_args() - suite = TestSuite(Environment(**vars(args))) + args = vars(parser.parse_args()) + if os.getenv("MJ_RUN", None) is not None: + args["mj_run"] = os.getenv("MJ_RUN") + suite = TestSuite(Environment(**args)) ret = None try: ret = suite.run() diff --git a/mjtest/environment.py b/mjtest/environment.py index 09236ab..ab21eba 100644 --- a/mjtest/environment.py +++ b/mjtest/environment.py @@ -5,7 +5,6 @@ import tempfile from datetime import datetime, time from mjtest.util.shell import execute from mjtest.util.utils import get_mjtest_basedir -import humanfriendly as hf from typing import Tuple, List @@ -28,11 +27,11 @@ class Environment: "debug": logging.DEBUG } - def __init__(self, mode, mj_run_cmd: str, tmp_dir: str = "", test_dir: str = "", + def __init__(self, mode, mj_run: str, tmp_dir: str = "", test_dir: str = "", only_incorrect_tests: bool = False, parallel: bool = False, timeout: int = 30, report_dir: str = "", log_level: str = "warn"): self.mode = mode - self.mj_run_cmd = os.path.realpath(mj_run_cmd) + self.mj_run_cmd = os.path.realpath(mj_run) if tmp_dir: self.own_tmp_dir = True diff --git a/setup.py b/setup.py index 2bff2ab..b85ae24 100644 --- a/setup.py +++ b/setup.py @@ -27,6 +27,7 @@ setup(name='mjtest', ''', install_requires=[ 'click', - 'humanfriendly', 'termcolor' + 'termcolor', + 'rainbow_logging_handler' ] ) -- GitLab