File tree 1 file changed +26
-0
lines changed
1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change
1
+ import platform
2
+ import sys
3
+
1
4
def assert_raises (expected , * args , _msg = None , ** kw ):
2
5
if args :
3
6
f , f_args = args [0 ], args [1 :]
@@ -67,3 +70,26 @@ def assert_isinstance(obj, klass):
67
70
68
71
def assert_in (a , b ):
69
72
_assert_print (lambda : a in b , [a , 'in' , b ])
73
+
74
+ def skip_if_unsupported (req_maj_vers , req_min_vers , test_fct ):
75
+ def exec ():
76
+ test_fct ()
77
+
78
+ if platform .python_implementation () == 'RustPython' :
79
+ exec ()
80
+ elif sys .version_info .major >= req_maj_vers and sys .version_info .minor >= req_min_vers :
81
+ exec ()
82
+ else :
83
+ print (f'Skipping test as a higher python version is required. Using { platform .python_implementation ()} { platform .python_version ()} ' )
84
+
85
+ def fail_if_unsupported (req_maj_vers , req_min_vers , test_fct ):
86
+ def exec ():
87
+ test_fct ()
88
+
89
+ if platform .python_implementation () == 'RustPython' :
90
+ exec ()
91
+ elif sys .version_info .major >= req_maj_vers and sys .version_info .minor >= req_min_vers :
92
+ exec ()
93
+ else :
94
+ assert False , f'Test cannot performed on this python version. { platform .python_implementation ()} { platform .python_version ()} '
95
+
You can’t perform that action at this time.
0 commit comments