From 367811a0b647a6123481308222d1763bdc68a555 Mon Sep 17 00:00:00 2001 From: Daniel J Magee Date: Tue, 22 Feb 2022 15:17:30 -0700 Subject: [PATCH] Flags for run_tests skip and only were not functional because the matching logic didn't work. Created logic that works. --- lib/pavilion/unittest.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/pavilion/unittest.py b/lib/pavilion/unittest.py index 79de74eae..8c386e85c 100644 --- a/lib/pavilion/unittest.py +++ b/lib/pavilion/unittest.py @@ -143,18 +143,14 @@ def __getattribute__(self, item): if self.SKIP: for skip_glob in self.SKIP: skip_glob = skip_glob.lower() - if (fnmatch.fnmatch(name, skip_glob) or - fnmatch.fnmatch(cname, skip_glob) or - fnmatch.fnmatch(fname, skip_glob)): + if any([skip_glob in nom for nom in (name, cname, fname)]): return unittest.skip("via cmdline")(attr) return attr if self.ONLY: for only_glob in self.ONLY: only_glob = only_glob.lower() - if (fnmatch.fnmatch(name, only_glob) or - fnmatch.fnmatch(cname, only_glob) or - fnmatch.fnmatch(fname, only_glob)): + if any([only_glob in nom for nom in (name, cname, fname)]): return attr return unittest.skip("via cmdline")(attr)