Skip to content

Commit

Permalink
tests: handle version dependent xfail if module not installed (#160)
Browse files Browse the repository at this point in the history
  • Loading branch information
ap-- authored Oct 23, 2023
1 parent 26ba0f3 commit befb71e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion upath/tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ def posixify(path):


def xfail_if_version(module, *, reason, **conditions):
ver = Version(get_package_version_without_import(module))
ver_str = get_package_version_without_import(module)
if ver_str is None:
return pytest.mark.skip(reason=f"NOT INSTALLED ({reason})")
ver = Version(ver_str)
if not set(conditions).issubset({"lt", "le", "ne", "eq", "ge", "gt"}):
raise ValueError("unknown condition")
cond = True
Expand Down

0 comments on commit befb71e

Please sign in to comment.