-
Notifications
You must be signed in to change notification settings - Fork 141
Closed
Description
Hi again,
With the latest 2.10.2 release, two tests fail for some values of RM_TS_DIR
, apparently it only happens when certain digits are present in the path. To reproduce:
$ RM_TS_DIR=/tmp/01/ nosetests -v tests/test_options/test_sorting.py
test_sorting.test_sorting ... ok
test_sorting.keep_testdir ... ok
test_sorting.create_testdir ... ok
test_sorting.test_sort_by_outlyer ... ok
test_sorting.test_sort_by_outlyer_hardcore ... ok
test_sorting.test_sort_by_regex ... FAIL
test_sorting.test_sort_by_regex_bad_input ... ok
test_sorting.test_regex_multiple_matches ... FAIL
======================================================================
FAIL: test_sorting.test_sort_by_regex
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/lib/python3.11/site-packages/nose/case.py", line 197, in runTest
self.test(*self.arg)
File "/tmp/build/rmlint/tests/test_options/test_sorting.py", line 169, in test_sort_by_regex
assert paths[1].endswith('d')
AssertionError
======================================================================
FAIL: test_sorting.test_regex_multiple_matches
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/lib/python3.11/site-packages/nose/case.py", line 197, in runTest
self.test(*self.arg)
File "/tmp/build/rmlint/tests/test_options/test_sorting.py", line 221, in test_regex_multiple_matches
assert [e['path'] for e in data] == [os.path.join(TESTDIR_NAME, p) for p in paths]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError
----------------------------------------------------------------------
Ran 8 tests in 36.428s
FAILED (failures=2)
Additional info can be obtained by running the desired tests with pytest:
_______________________________________________________________________________________________ test_sort_by_regex ________________________________________________________________________________________________
@with_setup(usual_setup_func, usual_teardown_func)
def test_sort_by_regex():
create_file('xxx', 'aaaa')
create_file('xxx', 'aaab')
create_file('xxx', 'b')
create_file('xxx', 'c')
create_file('xxx', '1/c')
create_file('xxx', 'd')
head, *data, footer = run_rmlint("-S 'r<1/c>x<d$>a'")
paths = [p['path'] for p in data]
assert paths[0].endswith('1/c')
> assert paths[1].endswith('d')
E AssertionError: assert False
E + where False = <built-in method endswith of str object at 0x7ff94e770df0>('d')
E + where <built-in method endswith of str object at 0x7ff94e770df0> = '/tmp/01/1/c'.endswith
tests/test_options/test_sorting.py:169: AssertionError
___________________________________________________________________________________________ test_regex_multiple_matches ___________________________________________________________________________________________
@with_setup(usual_setup_func, usual_teardown_func)
def test_regex_multiple_matches():
paths = [
'1/a', '1/a2', '1/b',
'2/a', '2/a2', '2/b',
]
for path in reversed(paths):
create_file('xxx', path)
# when multiple paths matched a regex, rmlint would not try the next criterion
# check multiple times because sort order was inconsistent before the fix
for _ in range(3):
head, *data, foot = run_rmlint("-S 'r<1>x<a>l'")
assert len(data) == len(paths)
> assert [e['path'] for e in data] == [os.path.join(TESTDIR_NAME, p) for p in paths]
E AssertionError: assert ['/tmp/01/1/a', '/tmp/01/2/a', '/tmp/01/1/a2', '/tmp/01/2/a2', '/tmp/01/1/b', '/tmp/01/2/b'] == ['/tmp/01/1/a', '/tmp/01/1/a2', '/tmp/01/1/b', '/tmp/01/2/a', '/tmp/01/2/a2', '/tmp/01/2/b']
E At index 1 diff: '/tmp/01/2/a' != '/tmp/01/1/a2'
E Full diff:
E [
E '/tmp/01/1/a',
E + '/tmp/01/2/a',
E '/tmp/01/1/a2',
E + '/tmp/01/2/a2',
E '/tmp/01/1/b',
E - '/tmp/01/2/a',
E - '/tmp/01/2/a2',
E '/tmp/01/2/b',
E ]
tests/test_options/test_sorting.py:221: AssertionError
Metadata
Metadata
Assignees
Labels
No labels