aboutsummaryrefslogtreecommitdiff
path: root/args.py
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2020-06-17 08:53:47 +0200
committerCharles <sircharlesaze@gmail.com>2020-06-17 08:53:47 +0200
commit24fc395a7853f03def1350f7ff35a7f819473b79 (patch)
treee776137c0840870a579b917aab00791b3e065fe6 /args.py
parent2ac2df38b1d812f5ef25a4d9a9f25143005b82b8 (diff)
downloadminishell_test-24fc395a7853f03def1350f7ff35a7f819473b79.tar.gz
minishell_test-24fc395a7853f03def1350f7ff35a7f819473b79.tar.bz2
minishell_test-24fc395a7853f03def1350f7ff35a7f819473b79.zip
Added Test and Suite class
Diffstat (limited to 'args.py')
-rw-r--r--args.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/args.py b/args.py
new file mode 100644
index 0000000..3fa4b7d
--- /dev/null
+++ b/args.py
@@ -0,0 +1,24 @@
+def parse_args():
+ parser = argparse.ArgumentParser(description="Minishell test", epilog="Make sure read README.md")
+ parser.add_argument("-v", "--verbose", action="store_true", help="print test result to stdout")
+ parser.add_argument("-g", "--generate", type=int, help="number of new random test to generate")
+ parser.add_argument("-l", "--list", action="store_true", help="print available test suites")
+ parser.add_argument("suites", nargs='*', metavar="suite",
+ help="test suites to run (available suites: {})".format(available_suites_str))
+ return parser.parse_args()
+
+def handle_args():
+ # utils.verbose = args.verbose
+
+ # check if selected suite is valid
+ for s in args.suites:
+ if s not in utils.available_suites:
+ print("{}: error: the `{}` suite doesn't exist, try {} --list"
+ .format(sys.argv[0], s, sys.argv[0]))
+ sys.exit(1)
+
+ # update ignored runned_suites according to the selected ones (if no suite is selected, all are run)
+ if len(args.suites) != 0:
+ for available in State.available_suites:
+ if available not in args.suites:
+ utils.ignored_suites.append(available)