Skip to content

[th/client-test-no-lineno] clients/tests: don't include the source line number with client tests output

Thomas Haller requested to merge th/client-test-no-lineno into master

The client tests compare the test output with a file persisted to disk which contains the expected output.

The expected output contains data like

size: 395
location: clients/tests/test-client.py:842:test_001()/1
cmd: $NMCLI
lang: C
returncode: 0
stdout: 277 bytes
>>>
...

Note that it contains the line number (clients/tests/test-client.py:842) where the test is called. This is to help correlate the output with the test code.

However, Python 3.8 changes behavior and for function calls that span multiple lines, frame.f_lineno will give the starting line (previously, it gave the last line) (see [1]).

No longer include the line number, as it is not stable accross Python versions.

If you really care, you can set NM_TEST_WITH_LINENO to get the line numbers back. Of course, then the expected output won't match anymore, and you'd have to regenerate it first. This is only useful if you debug tests, and want to have it easier to correlate output with the tests.

[1] https://bugs.python.org/issue38283


These tests fail on Fedora 32, which ships Python 3.8-beta ATM.

Merge request reports