Closed xymaxim closed 7 months ago
@zaufi wrote:
I've taken a closed look at the test added by the https://github.com/zaufi/pytest-matcher/pull/24 ... it looks incorrect to me %) makepatternfile() of the fixture behaves similarly to the pytester.makefile and does not write EOL at the last (and in this case the only) text line! So, strictly speaking, that test never checks for EOL styles...
Sorry, I didn’t get that. Just checked the output again, for example, for the \r\n
case:
test/test_matcher.py::failed_test[\\r\\n]
...
def test_not_matched(capfd, expected_out):
print('Unexpected output', end='\r\n')
stdout, stderr = capfd.readouterr()
print('stdout: ', repr(stdout))
> assert expected_out == stdout
E AssertionError: assert
E The test output doesn't equal to the expected
E (from `/tmp/pytest-of-ms/pytest-13/failed_test0/failed_test/test_not_matched.out`):
E ---[BEGIN actual output]---
E Unexpected output↵
E ---[END actual output]---
E ---[BEGIN expected output]---
E Hello Africa!
E ---[END expected output]---
failed_test.py:5: AssertionError
--------------------------------------------------------- Captured stdout call ---------------------------------------------------------
stdout: 'Unexpected output\r\n'
For each test, we have a different actual output captured from the stdout and the same expected output. I mean, we’re checking only the mismatch output for a failed test and that different EOLs are correctly replaced with a “↵” symbol, right?
Or is it something else there?
Or is it something else there?
Nope, u're right... I was tired and misunderstood the test
Changes in this PR
Expand a list of EOLs to be shown in the
full
mismatch mode to three most common line endings:\r
,\n
,\r\n
. This makes mismatch reporting work as intended on different platforms or when a custom text containing these characters is tested.