X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=test%2Fdiscover_tests.py;h=0eaa149d0db2fd41cffbaa414756c813c18aa980;hb=fe965a3a17fd543cb5a7caf37b25729c1683865b;hp=99016e2845ee1f0a3e60b5310b01c614852a3007;hpb=a98346f664aae148d26a8e158008b773d73db96f;p=vpp.git diff --git a/test/discover_tests.py b/test/discover_tests.py index 99016e2845e..0eaa149d0db 100755 --- a/test/discover_tests.py +++ b/test/discover_tests.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import sys import os @@ -22,8 +22,6 @@ def discover_tests(directory, callback): if not _f.startswith("test_") or not _f.endswith(".py"): continue name = "".join(f.split("/")[-1].split(".")[:-1]) - if name in sys.modules: - raise Exception("Duplicate test module `%s' found!" % name) module = importlib.import_module(name) for name, cls in module.__dict__.items(): if not isinstance(cls, type): @@ -41,17 +39,3 @@ def discover_tests(directory, callback): def print_callback(file_name, cls, method): print("%s.%s.%s" % (file_name, cls.__name__, method)) - - -if __name__ == '__main__': - parser = argparse.ArgumentParser(description="Discover VPP unit tests") - parser.add_argument("-d", "--dir", action='append', type=str, - help="directory containing test files " - "(may be specified multiple times)") - args = parser.parse_args() - if args.dir is None: - args.dir = "." - - suite = unittest.TestSuite() - for d in args.dir: - discover_tests(d, print_callback)