Commit 21d25cb7 authored by Paul Hervot's avatar Paul Hervot
Browse files

tests: make the testsuite Python 3.7 compatible

In Python 3.7, the re module changes the name of its _pattern_type
attribute to "Pattern", this patch handles both versions
parent dc90ec99
Pipeline #11811 failed with stage
in 169 minutes and 18 seconds
...@@ -7,6 +7,12 @@ import sys ...@@ -7,6 +7,12 @@ import sys
import vcsn import vcsn
try:
repatterntype = re.Pattern
except AttributeError:
# Before Python 3.7
repatterntype = re._pattern_type
ntest = 0 ntest = 0
npass = 0 npass = 0
nfail = 0 nfail = 0
...@@ -169,7 +175,7 @@ def XFAIL(fun, exp=None): ...@@ -169,7 +175,7 @@ def XFAIL(fun, exp=None):
# while reading automaton: efsm.dir/bad_final_weight.efsm # while reading automaton: efsm.dir/bad_final_weight.efsm
eff = str(e).replace(medir + '/', '') eff = str(e).replace(medir + '/', '')
if (exp is None if (exp is None
or isinstance(exp, re._pattern_type) and re.match(exp, eff) or isinstance(exp, repatterntype) and re.match(exp, eff)
or isinstance(exp, str) and exp in eff): or isinstance(exp, str) and exp in eff):
PASS() PASS()
else: else:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment