-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cleanly support UnionType where possible in 3.9
* Conditionalize some tests as 3.9 seems to not like treating UnionType as values * Simplify test skipping for uniontype
- Loading branch information
Showing
5 changed files
with
95 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import sys | ||
import pytest | ||
from functools import wraps | ||
from typing import Any, Callable | ||
|
||
|
||
def min_py(major: int, minor: int) -> bool: | ||
return sys.version_info < (major, minor) | ||
|
||
|
||
def skip_if_uniontype_unsupported( | ||
func: Callable[..., Any], | ||
) -> Callable[..., Any]: | ||
@wraps(func) | ||
def wrapper(*args: Any, **kwargs: Any) -> None: | ||
if min_py(3, 10): | ||
pytest.skip("UnionType requires >= py3.10") | ||
return None | ||
return func(*args, **kwargs) | ||
|
||
return wrapper |