This repository has been archived by the owner on Oct 1, 2024. It is now read-only.
0.54.0b0 - Conditional skip and xfail
darrenburns
released this
02 Apr 18:32
·
124 commits
to master
since this release
Adds when
param to @skip
and @xfail
decorators, allowing you to only apply them when some boolean or Callable predicate holds. e.g.
@skip("Skipped on Windows", when=platform.system() == "Windows")
@test("_build_package_name constructs package name '{pkg}' from '{path}'")
def _(
pkg=each("", "foo", "foo.bar"),
path=each("foo.py", "foo/bar.py", "foo/bar/baz.py"),
):
m = ModuleType(name="")
m.__file__ = path
assert _build_package_name(m) == pkg
@skip("Skipped on Unix", when=platform.system() != "Windows")
@test("_build_package_name constructs package name '{pkg}' from '{path}'")
def _(
pkg=each("", "foo", "foo.bar"),
path=each("foo.py", "foo\\bar.py", "foo\\bar\\baz.py"),
):
m = ModuleType(name="")
m.__file__ = path
assert _build_package_name(m) == pkg
When run on a non-Windows system: