Skip to content

Commit f314f68

Browse files
maj0edcbaker
authored andcommitted
tests: Fix regex in test_slice
If the first line already conained a match, the former regex didn't catch it correctly, because it was looking for a newline character to detect the start of a line. The new regex is using the proper `^` to match the beginning of a line. For this to work as expected the `re.MULTILINE` flag has to be set.
1 parent a01cede commit f314f68

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎unittests/allplatformstests.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5451,7 +5451,9 @@ def test_slice(self):
54515451
'10/10': [10],
54525452
}.items():
54535453
output = self._run(self.mtest_command + ['--slice=' + arg])
5454-
tests = sorted([ int(x) for x in re.findall(r'\n[ 0-9]+/[0-9]+ test_slice:test-([0-9]*)', output) ])
5454+
tests = sorted([
5455+
int(x) for x in re.findall(r'^[ 0-9]+/[0-9]+ test_slice:test-([0-9]*)', output, flags=re.MULTILINE)
5456+
])
54555457
self.assertEqual(tests, expectation)
54565458

54575459
for arg, expectation in {'': 'error: argument --slice: value does not conform to format \'SLICE/NUM_SLICES\'',

0 commit comments

Comments
 (0)