|
3 | 3 |
|
4 | 4 | import itertools |
5 | 5 |
|
6 | | -from numba.core import errors |
| 6 | +import pytest |
| 7 | + |
| 8 | +from numba.cuda.core import config, errors |
7 | 9 | from numba.cuda import types, typing |
8 | 10 | from numba.cuda.typeconv import Conversion |
9 | 11 |
|
10 | | -from numba.cuda.testing import CUDATestCase, skip_on_cudasim |
| 12 | +from numba.cuda.testing import CUDATestCase |
11 | 13 | from numba.cuda.tests.cudapy.test_typeconv import CompatibilityTestMixin |
12 | 14 | from numba.cuda.core.untyped_passes import TranslateByteCode, IRProcessing |
13 | 15 | from numba.cuda.core.typed_passes import PartialTypeInference |
@@ -511,28 +513,25 @@ def define_pipelines(self): |
511 | 513 | return pipeline.state.typing_errors |
512 | 514 |
|
513 | 515 |
|
514 | | -@skip_on_cudasim("not available on sim") |
515 | | -class TestPartialTypingErrors(CUDATestCase): |
| 516 | +@pytest.mark.skipif(config.ENABLE_CUDASIM, reason="not enable in the simulator") |
| 517 | +def test_partial_typing_error(): |
516 | 518 | """ |
517 | 519 | Make sure partial typing stores type errors in compiler state properly |
518 | 520 | """ |
519 | 521 |
|
520 | | - def test_partial_typing_error(self): |
521 | | - # example with type unification error |
522 | | - def impl(flag): |
523 | | - if flag: |
524 | | - a = 1 |
525 | | - else: |
526 | | - a = "" |
527 | | - return a |
528 | | - |
529 | | - self.assertRaisesRegex( |
530 | | - errors.TypingError, |
531 | | - r"Cannot unify Literal\[int]\(1\) and Literal\[str]\(\) for 'a'", |
532 | | - get_func_typing_errs, |
533 | | - impl, |
534 | | - (types.bool_,), |
535 | | - ) |
| 522 | + # example with type unification error |
| 523 | + def impl(flag): |
| 524 | + if flag: |
| 525 | + a = 1 |
| 526 | + else: |
| 527 | + a = "" |
| 528 | + return a |
| 529 | + |
| 530 | + with pytest.raises( |
| 531 | + errors.TypingError, |
| 532 | + match=r"Cannot unify Literal\[int\]\(1\) and Literal\[str\]\(\) for 'a'", |
| 533 | + ): |
| 534 | + get_func_typing_errs(impl, (types.bool_,)) |
536 | 535 |
|
537 | 536 |
|
538 | 537 | if __name__ == "__main__": |
|
0 commit comments