|
4 | 4 | # SPDX-License-Identifier: BSD-3-Clause |
5 | 5 |
|
6 | 6 | import pytest |
| 7 | +from collections import namedtuple |
7 | 8 |
|
8 | 9 | import reframe as rfm |
9 | 10 | import reframe.core.exceptions as errors |
10 | 11 | import reframe.frontend.executors as executors |
11 | 12 | import reframe.frontend.filters as filters |
12 | 13 | import reframe.utility.sanity as sn |
13 | 14 | import unittests.utility as test_util |
14 | | -from reframe.core.exceptions import ReframeError |
15 | 15 |
|
16 | 16 |
|
17 | 17 | def count_checks(filter_fn, checks): |
18 | 18 | return sn.count(filter(filter_fn, checks)) |
19 | 19 |
|
20 | 20 |
|
21 | 21 | def make_case(*args, **kwargs): |
| 22 | + _P = namedtuple('_Partition', ['fullname']) |
| 23 | + _E = namedtuple('_Environment', ['name']) |
22 | 24 | test = test_util.make_check(*args, **kwargs) |
23 | | - return executors.TestCase(test, None, None) |
| 25 | + return executors.TestCase(test, _P('generic:default'), _E('builtin')) |
24 | 26 |
|
25 | 27 |
|
26 | 28 | @pytest.fixture |
@@ -156,15 +158,13 @@ def test_validates_expr_invalid(sample_cases): |
156 | 158 | validates = filters.validates |
157 | 159 |
|
158 | 160 | # undefined variables |
159 | | - with pytest.raises(ReframeError): |
160 | | - assert count_checks(validates('foo == 3'), sample_cases) |
| 161 | + assert count_checks(validates('foo == 3'), sample_cases) == 0 |
161 | 162 |
|
162 | | - # invalid syntax |
163 | | - with pytest.raises(ReframeError): |
164 | | - assert count_checks(validates('num_tasks = 2'), sample_cases) |
| 163 | + # assignments |
| 164 | + assert count_checks(validates('num_tasks = 2'), sample_cases) == 0 |
165 | 165 |
|
166 | | - with pytest.raises(ReframeError): |
167 | | - assert count_checks(validates('import os'), sample_cases) |
| 166 | + # imports |
| 167 | + assert count_checks(validates('import os'), sample_cases) == 0 |
168 | 168 |
|
169 | | - with pytest.raises(ReframeError): |
170 | | - assert count_checks(validates('"foo" i tags'), sample_cases) |
| 169 | + # invalid syntax |
| 170 | + assert count_checks(validates('"foo" i tags'), sample_cases) == 0 |
0 commit comments