From 3168a6a3036832dc857f69c152d797eb32d61be0 Mon Sep 17 00:00:00 2001 From: Hendrik Brucker Date: Sat, 20 Aug 2022 14:41:05 +0200 Subject: Add a Python script to create new test suites more quickly Co-authored-by: Hugo Locurcio --- tests/create_test.py | 132 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 132 insertions(+) create mode 100644 tests/create_test.py (limited to 'tests') diff --git a/tests/create_test.py b/tests/create_test.py new file mode 100644 index 0000000000..5a0439084f --- /dev/null +++ b/tests/create_test.py @@ -0,0 +1,132 @@ +#!/usr/bin/env python3 + +import argparse +import os +import re +import sys +from subprocess import call + + +def main(): + # Change to the directory where the script is located, + # so that the script can be run from any location. + os.chdir(os.path.dirname(os.path.realpath(__file__))) + + parser = argparse.ArgumentParser(description="Creates a new unit test file.") + parser.add_argument("name", type=str, help="The unit test name in PascalCase notation") + parser.add_argument( + "path", + type=str, + nargs="?", + help="The path to the unit test file relative to the tests folder (default: .)", + default=".", + ) + parser.add_argument( + "-i", + "--invasive", + action="store_true", + help="if set, the script will automatically insert the include directive in test_main.cpp. Use with caution!", + ) + args = parser.parse_args() + + snake_case_regex = re.compile(r"(?