Skip to content

Commit 74ab7ce

Browse files
committed
Fix pattern parsing from <package>:<pattern> string
Split `<pattern>` argument into tests_dir glob and pattern glob as being found in unittesting.json. MyPackage:mytests/**/test*.py => package=MyPackage, tests_dir=mytests/**, pattern=test.py If no path is given, `tests_dir` from unittesting.json or default is used. MyPackage:test*.py => package=MyPackage, tests_dir=tests/, pattern=test.py
1 parent ccda2b4 commit 74ab7ce

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

unittesting/unit.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,11 @@ def run(self, package=None, **kwargs):
5656
# parse input of form `<package>:<pattern>`
5757
parts = package.split(":", 1)
5858
if len(parts) == 2:
59-
package, kwargs["pattern"] = parts
59+
package, pattern = parts
60+
tests_dir, pattern = os.path.split(pattern)
61+
if tests_dir:
62+
kwargs["tests_dir"] = tests_dir
63+
kwargs["pattern"] = pattern
6064

6165
# resolve real package name
6266
if package == "$package_name":

0 commit comments

Comments
 (0)