Commit 11722f1f authored by Johannes Bechberger's avatar Johannes Bechberger
Browse files

Add missing required package to

parent 70163d26
......@@ -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:
What do you want to test?
MJ_RUN_CMD Command to run your MiniJava implementation, e.g.
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
import logging
import os
from pprint import pprint
import sys
import mjtest.util.utils
......@@ -26,9 +27,11 @@ if True:#__name__ == '__main__':
help="What do you want to test?")
help="Command to run your MiniJava implementation, e.g. `mj/run`")
if os.getenv("MJ_RUN", None) is None:
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
ret =
......@@ -5,7 +5,6 @@ import tempfile
from datetime import datetime, time
from 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
......@@ -27,6 +27,7 @@ setup(name='mjtest',
'humanfriendly', 'termcolor'
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment