Skip to content

Commit bc07a25

Browse files
committed
Improve testing for python 3.9
1 parent 6e28504 commit bc07a25

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

src/psyclone/tests/psyir/transformations/transformations_test.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
API-agnostic tests for various transformation classes.
4141
'''
4242

43+
import sys
4344
import os
4445
import pytest
4546
from fparser.common.readfortran import FortranStringReader
@@ -590,13 +591,16 @@ def test_omploop_trans_new_options(sample_psyir):
590591

591592
with pytest.raises(TypeError) as excinfo:
592593
omplooptrans.apply(tree.walk(Loop)[0], collapse="x")
593-
# The exact error message depends on the python version, so we only
594-
# check it produced the TypeError but not the specific message.
595-
# assert ("'OMPLoopTrans' received options with the wrong types:\n"
596-
# "'collapse' option expects type 'int | bool' but "
597-
# "received 'x' of type 'str'.\n"
598-
# "Please see the documentation and check the provided types."
599-
# in str(excinfo.value))
594+
if sys.version_info >= (3, 10):
595+
assert ("'OMPLoopTrans' received options with the wrong types:\n"
596+
"'collapse' option expects type 'int | bool' but "
597+
"received 'x' of type 'str'.\n"
598+
"Please see the documentation and check the provided types."
599+
in str(excinfo.value))
600+
else:
601+
assert ("The 'collapse' argument must be an integer or a bool but got"
602+
" an object of type <class 'str'>"
603+
in str(excinfo.value))
600604

601605

602606
def test_omplooptrans_apply_nowait(fortran_reader, fortran_writer):

0 commit comments

Comments
 (0)