client: tests: avoid mixing stdout and stderr output on failure

On failure the self.fail() message often appears in the middle of the
diff between expected/actual output, making it hard to read. Since
print() output goes to stdout (which is buffered) and self.fail() to
stderr (which is not), flush stdout before printing the failure
message to ensure the two don't mix.
This commit is contained in:
Beniamino Galvani 2018-10-25 14:43:44 +02:00
parent f8fed7dd52
commit d9e931acaf
5 changed files with 1341 additions and 1339 deletions

View file

@ -1,5 +1,5 @@
size: 395
location: clients/tests/test-client.py:827:test_001()/1
location: clients/tests/test-client.py:829:test_001()/1
cmd: $NMCLI
lang: C
returncode: 0
@ -15,7 +15,7 @@ Consult nmcli(1) and nmcli-examples(5) manual pages for complete usage details.
<<<
size: 438
location: clients/tests/test-client.py:827:test_001()/2
location: clients/tests/test-client.py:829:test_001()/2
cmd: $NMCLI
lang: pl_PL.UTF-8
returncode: 0
@ -33,7 +33,7 @@ o użyciu.
<<<
size: 188
location: clients/tests/test-client.py:829:test_001()/3
location: clients/tests/test-client.py:831:test_001()/3
cmd: $NMCLI -f AP -mode multiline -p d show wlan0
lang: C
returncode: 10
@ -43,7 +43,7 @@ Error: Device 'wlan0' not found.
<<<
size: 214
location: clients/tests/test-client.py:829:test_001()/4
location: clients/tests/test-client.py:831:test_001()/4
cmd: $NMCLI -f AP -mode multiline -p d show wlan0
lang: pl_PL.UTF-8
returncode: 10
@ -53,7 +53,7 @@ Błąd: Nie odnaleziono urządzenia „wlan0”.
<<<
size: 120
location: clients/tests/test-client.py:831:test_001()/5
location: clients/tests/test-client.py:833:test_001()/5
cmd: $NMCLI c s
lang: C
returncode: 0
@ -63,7 +63,7 @@ stdout: 1 bytes
<<<
size: 130
location: clients/tests/test-client.py:831:test_001()/6
location: clients/tests/test-client.py:833:test_001()/6
cmd: $NMCLI c s
lang: pl_PL.UTF-8
returncode: 0
@ -73,7 +73,7 @@ stdout: 1 bytes
<<<
size: 192
location: clients/tests/test-client.py:833:test_001()/7
location: clients/tests/test-client.py:835:test_001()/7
cmd: $NMCLI bogus s
lang: C
returncode: 2
@ -83,7 +83,7 @@ Error: argument 'bogus' not understood. Try passing --help instead.
<<<
size: 221
location: clients/tests/test-client.py:833:test_001()/8
location: clients/tests/test-client.py:835:test_001()/8
cmd: $NMCLI bogus s
lang: pl_PL.UTF-8
returncode: 2
@ -93,7 +93,7 @@ Błąd: nie zrozumiano parametru „bogus”. Można użyć „--help” zamiast
<<<
size: 1413
location: clients/tests/test-client.py:836:test_001()/9
location: clients/tests/test-client.py:838:test_001()/9
cmd: $NMCLI general permissions
lang: C
returncode: 0
@ -119,7 +119,7 @@ org.freedesktop.NetworkManager.enable-disable-connectivity-check unknown
<<<
size: 1441
location: clients/tests/test-client.py:836:test_001()/10
location: clients/tests/test-client.py:838:test_001()/10
cmd: $NMCLI general permissions
lang: pl_PL.UTF-8
returncode: 0
@ -145,7 +145,7 @@ org.freedesktop.NetworkManager.enable-disable-connectivity-check nieznane
<<<
size: 1543
location: clients/tests/test-client.py:836:test_001()/11
location: clients/tests/test-client.py:838:test_001()/11
cmd: $NMCLI --color yes general permissions
lang: C
returncode: 0
@ -171,7 +171,7 @@ org.freedesktop.NetworkManager.enable-disable-connectivity-check unknown
<<<
size: 1570
location: clients/tests/test-client.py:836:test_001()/12
location: clients/tests/test-client.py:838:test_001()/12
cmd: $NMCLI --color yes general permissions
lang: pl_PL.UTF-8
returncode: 0
@ -197,7 +197,7 @@ org.freedesktop.NetworkManager.enable-disable-connectivity-check nieznane
<<<
size: 1620
location: clients/tests/test-client.py:836:test_001()/13
location: clients/tests/test-client.py:838:test_001()/13
cmd: $NMCLI --pretty general permissions
lang: C
returncode: 0
@ -227,7 +227,7 @@ org.freedesktop.NetworkManager.enable-disable-connectivity-check unknown
<<<
size: 1677
location: clients/tests/test-client.py:836:test_001()/14
location: clients/tests/test-client.py:838:test_001()/14
cmd: $NMCLI --pretty general permissions
lang: pl_PL.UTF-8
returncode: 0
@ -257,7 +257,7 @@ org.freedesktop.NetworkManager.enable-disable-connectivity-check nieznane
<<<
size: 1749
location: clients/tests/test-client.py:836:test_001()/15
location: clients/tests/test-client.py:838:test_001()/15
cmd: $NMCLI --pretty --color yes general permissions
lang: C
returncode: 0
@ -287,7 +287,7 @@ org.freedesktop.NetworkManager.enable-disable-connectivity-check unknown
<<<
size: 1806
location: clients/tests/test-client.py:836:test_001()/16
location: clients/tests/test-client.py:838:test_001()/16
cmd: $NMCLI --pretty --color yes general permissions
lang: pl_PL.UTF-8
returncode: 0
@ -317,7 +317,7 @@ org.freedesktop.NetworkManager.enable-disable-connectivity-check nieznane
<<<
size: 1045
location: clients/tests/test-client.py:836:test_001()/17
location: clients/tests/test-client.py:838:test_001()/17
cmd: $NMCLI --terse general permissions
lang: C
returncode: 0
@ -342,7 +342,7 @@ org.freedesktop.NetworkManager.enable-disable-connectivity-check:unknown
<<<
size: 1055
location: clients/tests/test-client.py:836:test_001()/18
location: clients/tests/test-client.py:838:test_001()/18
cmd: $NMCLI --terse general permissions
lang: pl_PL.UTF-8
returncode: 0
@ -367,7 +367,7 @@ org.freedesktop.NetworkManager.enable-disable-connectivity-check:unknown
<<<
size: 1175
location: clients/tests/test-client.py:836:test_001()/19
location: clients/tests/test-client.py:838:test_001()/19
cmd: $NMCLI --terse --color yes general permissions
lang: C
returncode: 0
@ -392,7 +392,7 @@ org.freedesktop.NetworkManager.enable-disable-connectivity-check:unknown
<<<
size: 1185
location: clients/tests/test-client.py:836:test_001()/20
location: clients/tests/test-client.py:838:test_001()/20
cmd: $NMCLI --terse --color yes general permissions
lang: pl_PL.UTF-8
returncode: 0
@ -417,7 +417,7 @@ org.freedesktop.NetworkManager.enable-disable-connectivity-check:unknown
<<<
size: 1429
location: clients/tests/test-client.py:836:test_001()/21
location: clients/tests/test-client.py:838:test_001()/21
cmd: $NMCLI --mode tabular general permissions
lang: C
returncode: 0
@ -443,7 +443,7 @@ org.freedesktop.NetworkManager.enable-disable-connectivity-check unknown
<<<
size: 1456
location: clients/tests/test-client.py:836:test_001()/22
location: clients/tests/test-client.py:838:test_001()/22
cmd: $NMCLI --mode tabular general permissions
lang: pl_PL.UTF-8
returncode: 0
@ -469,7 +469,7 @@ org.freedesktop.NetworkManager.enable-disable-connectivity-check nieznane
<<<
size: 1558
location: clients/tests/test-client.py:836:test_001()/23
location: clients/tests/test-client.py:838:test_001()/23
cmd: $NMCLI --mode tabular --color yes general permissions
lang: C
returncode: 0
@ -495,7 +495,7 @@ org.freedesktop.NetworkManager.enable-disable-connectivity-check unknown
<<<
size: 1585
location: clients/tests/test-client.py:836:test_001()/24
location: clients/tests/test-client.py:838:test_001()/24
cmd: $NMCLI --mode tabular --color yes general permissions
lang: pl_PL.UTF-8
returncode: 0
@ -521,7 +521,7 @@ org.freedesktop.NetworkManager.enable-disable-connectivity-check nieznane
<<<
size: 1635
location: clients/tests/test-client.py:836:test_001()/25
location: clients/tests/test-client.py:838:test_001()/25
cmd: $NMCLI --mode tabular --pretty general permissions
lang: C
returncode: 0
@ -551,7 +551,7 @@ org.freedesktop.NetworkManager.enable-disable-connectivity-check unknown
<<<
size: 1692
location: clients/tests/test-client.py:836:test_001()/26
location: clients/tests/test-client.py:838:test_001()/26
cmd: $NMCLI --mode tabular --pretty general permissions
lang: pl_PL.UTF-8
returncode: 0
@ -581,7 +581,7 @@ org.freedesktop.NetworkManager.enable-disable-connectivity-check nieznane
<<<
size: 1764
location: clients/tests/test-client.py:836:test_001()/27
location: clients/tests/test-client.py:838:test_001()/27
cmd: $NMCLI --mode tabular --pretty --color yes general permissions
lang: C
returncode: 0
@ -611,7 +611,7 @@ org.freedesktop.NetworkManager.enable-disable-connectivity-check unknown
<<<
size: 1821
location: clients/tests/test-client.py:836:test_001()/28
location: clients/tests/test-client.py:838:test_001()/28
cmd: $NMCLI --mode tabular --pretty --color yes general permissions
lang: pl_PL.UTF-8
returncode: 0
@ -641,7 +641,7 @@ org.freedesktop.NetworkManager.enable-disable-connectivity-check nieznane
<<<
size: 1060
location: clients/tests/test-client.py:836:test_001()/29
location: clients/tests/test-client.py:838:test_001()/29
cmd: $NMCLI --mode tabular --terse general permissions
lang: C
returncode: 0
@ -666,7 +666,7 @@ org.freedesktop.NetworkManager.enable-disable-connectivity-check:unknown
<<<
size: 1070
location: clients/tests/test-client.py:836:test_001()/30
location: clients/tests/test-client.py:838:test_001()/30
cmd: $NMCLI --mode tabular --terse general permissions
lang: pl_PL.UTF-8
returncode: 0
@ -691,7 +691,7 @@ org.freedesktop.NetworkManager.enable-disable-connectivity-check:unknown
<<<
size: 1190
location: clients/tests/test-client.py:836:test_001()/31
location: clients/tests/test-client.py:838:test_001()/31
cmd: $NMCLI --mode tabular --terse --color yes general permissions
lang: C
returncode: 0
@ -716,7 +716,7 @@ org.freedesktop.NetworkManager.enable-disable-connectivity-check:unknown
<<<
size: 1200
location: clients/tests/test-client.py:836:test_001()/32
location: clients/tests/test-client.py:838:test_001()/32
cmd: $NMCLI --mode tabular --terse --color yes general permissions
lang: pl_PL.UTF-8
returncode: 0
@ -741,7 +741,7 @@ org.freedesktop.NetworkManager.enable-disable-connectivity-check:unknown
<<<
size: 2335
location: clients/tests/test-client.py:836:test_001()/33
location: clients/tests/test-client.py:838:test_001()/33
cmd: $NMCLI --mode multiline general permissions
lang: C
returncode: 0
@ -782,7 +782,7 @@ VALUE: unknown
<<<
size: 2351
location: clients/tests/test-client.py:836:test_001()/34
location: clients/tests/test-client.py:838:test_001()/34
cmd: $NMCLI --mode multiline general permissions
lang: pl_PL.UTF-8
returncode: 0
@ -823,7 +823,7 @@ VALUE: nieznane
<<<
size: 2464
location: clients/tests/test-client.py:836:test_001()/35
location: clients/tests/test-client.py:838:test_001()/35
cmd: $NMCLI --mode multiline --color yes general permissions
lang: C
returncode: 0
@ -864,7 +864,7 @@ VALUE: unknown
<<<
size: 2480
location: clients/tests/test-client.py:836:test_001()/36
location: clients/tests/test-client.py:838:test_001()/36
cmd: $NMCLI --mode multiline --color yes general permissions
lang: pl_PL.UTF-8
returncode: 0
@ -905,7 +905,7 @@ VALUE: nieznane
<<<
size: 3837
location: clients/tests/test-client.py:836:test_001()/37
location: clients/tests/test-client.py:838:test_001()/37
cmd: $NMCLI --mode multiline --pretty general permissions
lang: C
returncode: 0
@ -965,7 +965,7 @@ VALUE: unknown
<<<
size: 3858
location: clients/tests/test-client.py:836:test_001()/38
location: clients/tests/test-client.py:838:test_001()/38
cmd: $NMCLI --mode multiline --pretty general permissions
lang: pl_PL.UTF-8
returncode: 0
@ -1025,7 +1025,7 @@ VALUE: nieznane
<<<
size: 3966
location: clients/tests/test-client.py:836:test_001()/39
location: clients/tests/test-client.py:838:test_001()/39
cmd: $NMCLI --mode multiline --pretty --color yes general permissions
lang: C
returncode: 0
@ -1085,7 +1085,7 @@ VALUE: unknown
<<<
size: 3987
location: clients/tests/test-client.py:836:test_001()/40
location: clients/tests/test-client.py:838:test_001()/40
cmd: $NMCLI --mode multiline --pretty --color yes general permissions
lang: pl_PL.UTF-8
returncode: 0
@ -1145,7 +1145,7 @@ VALUE: nieznane
<<<
size: 1335
location: clients/tests/test-client.py:836:test_001()/41
location: clients/tests/test-client.py:838:test_001()/41
cmd: $NMCLI --mode multiline --terse general permissions
lang: C
returncode: 0
@ -1186,7 +1186,7 @@ VALUE:unknown
<<<
size: 1345
location: clients/tests/test-client.py:836:test_001()/42
location: clients/tests/test-client.py:838:test_001()/42
cmd: $NMCLI --mode multiline --terse general permissions
lang: pl_PL.UTF-8
returncode: 0
@ -1227,7 +1227,7 @@ VALUE:unknown
<<<
size: 1464
location: clients/tests/test-client.py:836:test_001()/43
location: clients/tests/test-client.py:838:test_001()/43
cmd: $NMCLI --mode multiline --terse --color yes general permissions
lang: C
returncode: 0
@ -1268,7 +1268,7 @@ VALUE:unknown
<<<
size: 1474
location: clients/tests/test-client.py:836:test_001()/44
location: clients/tests/test-client.py:838:test_001()/44
cmd: $NMCLI --mode multiline --terse --color yes general permissions
lang: pl_PL.UTF-8
returncode: 0

View file

@ -1,5 +1,5 @@
size: 377
location: clients/tests/test-client.py:842:test_002()/1
location: clients/tests/test-client.py:844:test_002()/1
cmd: $NMCLI d
lang: C
returncode: 0
@ -14,7 +14,7 @@ wlan1 wifi unavailable --
<<<
size: 392
location: clients/tests/test-client.py:842:test_002()/2
location: clients/tests/test-client.py:844:test_002()/2
cmd: $NMCLI d
lang: pl_PL.UTF-8
returncode: 0
@ -29,7 +29,7 @@ wlan1 wifi niedostępne --
<<<
size: 978
location: clients/tests/test-client.py:844:test_002()/3
location: clients/tests/test-client.py:846:test_002()/3
cmd: $NMCLI -f all d
lang: C
returncode: 0
@ -44,7 +44,7 @@ wlan1 wifi unavailable unknown unknown /org/freedesk
<<<
size: 993
location: clients/tests/test-client.py:844:test_002()/4
location: clients/tests/test-client.py:846:test_002()/4
cmd: $NMCLI -f all d
lang: pl_PL.UTF-8
returncode: 0
@ -59,7 +59,7 @@ wlan1 wifi niedostępne nieznane nieznane /org/freedes
<<<
size: 739
location: clients/tests/test-client.py:846:test_002()/5
location: clients/tests/test-client.py:848:test_002()/5
cmd: $NMCLI
lang: C
returncode: 0
@ -95,7 +95,7 @@ Consult nmcli(1) and nmcli-examples(5) manual pages for complete usage details.
<<<
size: 812
location: clients/tests/test-client.py:846:test_002()/6
location: clients/tests/test-client.py:848:test_002()/6
cmd: $NMCLI
lang: pl_PL.UTF-8
returncode: 0
@ -133,7 +133,7 @@ o użyciu.
<<<
size: 1260
location: clients/tests/test-client.py:848:test_002()/7
location: clients/tests/test-client.py:850:test_002()/7
cmd: $NMCLI -f AP -mode multiline d show wlan0
lang: C
returncode: 0
@ -166,7 +166,7 @@ AP[3].SECURITY: WPA1 WPA2
<<<
size: 1297
location: clients/tests/test-client.py:848:test_002()/8
location: clients/tests/test-client.py:850:test_002()/8
cmd: $NMCLI -f AP -mode multiline d show wlan0
lang: pl_PL.UTF-8
returncode: 0
@ -199,7 +199,7 @@ AP[3].SECURITY: WPA1 WPA2
<<<
size: 1714
location: clients/tests/test-client.py:849:test_002()/9
location: clients/tests/test-client.py:851:test_002()/9
cmd: $NMCLI -f AP -mode multiline -p d show wlan0
lang: C
returncode: 0
@ -238,7 +238,7 @@ AP[3].SECURITY: WPA1 WPA2
<<<
size: 1759
location: clients/tests/test-client.py:849:test_002()/10
location: clients/tests/test-client.py:851:test_002()/10
cmd: $NMCLI -f AP -mode multiline -p d show wlan0
lang: pl_PL.UTF-8
returncode: 0
@ -277,7 +277,7 @@ AP[3].SECURITY: WPA1 WPA2
<<<
size: 591
location: clients/tests/test-client.py:850:test_002()/11
location: clients/tests/test-client.py:852:test_002()/11
cmd: $NMCLI -f AP -mode multiline -t d show wlan0
lang: C
returncode: 0
@ -310,7 +310,7 @@ AP[3].SECURITY:WPA1 WPA2
<<<
size: 628
location: clients/tests/test-client.py:850:test_002()/12
location: clients/tests/test-client.py:852:test_002()/12
cmd: $NMCLI -f AP -mode multiline -t d show wlan0
lang: pl_PL.UTF-8
returncode: 0
@ -343,7 +343,7 @@ AP[3].SECURITY:WPA1 WPA2
<<<
size: 455
location: clients/tests/test-client.py:851:test_002()/13
location: clients/tests/test-client.py:853:test_002()/13
cmd: $NMCLI -f AP -mode tabular d show wlan0
lang: C
returncode: 0
@ -356,7 +356,7 @@ AP[3] wlan0-ap-2 Infra 1 54 Mbit/s 34 ** WPA1 WPA2
<<<
size: 499
location: clients/tests/test-client.py:851:test_002()/14
location: clients/tests/test-client.py:853:test_002()/14
cmd: $NMCLI -f AP -mode tabular d show wlan0
lang: pl_PL.UTF-8
returncode: 0
@ -369,7 +369,7 @@ AP[3] wlan0-ap-2 Infrastruktura 1 54Mb/s 34 ** WPA1 W
<<<
size: 614
location: clients/tests/test-client.py:852:test_002()/15
location: clients/tests/test-client.py:854:test_002()/15
cmd: $NMCLI -f AP -mode tabular -p d show wlan0
lang: C
returncode: 0
@ -386,7 +386,7 @@ AP[3] wlan0-ap-2 Infra 1 54 Mbit/s 34 ** WPA1 WPA2
<<<
size: 694
location: clients/tests/test-client.py:852:test_002()/16
location: clients/tests/test-client.py:854:test_002()/16
cmd: $NMCLI -f AP -mode tabular -p d show wlan0
lang: pl_PL.UTF-8
returncode: 0
@ -403,7 +403,7 @@ AP[3] wlan0-ap-2 Infrastruktura 1 54Mb/s 34 ** WPA1 W
<<<
size: 319
location: clients/tests/test-client.py:853:test_002()/17
location: clients/tests/test-client.py:855:test_002()/17
cmd: $NMCLI -f AP -mode tabular -t d show wlan0
lang: C
returncode: 0
@ -415,7 +415,7 @@ AP[3]: :wlan0-ap-2:Infra:1:54 Mbit/s:34:** :WPA1 WPA2
<<<
size: 356
location: clients/tests/test-client.py:853:test_002()/18
location: clients/tests/test-client.py:855:test_002()/18
cmd: $NMCLI -f AP -mode tabular -t d show wlan0
lang: pl_PL.UTF-8
returncode: 0
@ -427,7 +427,7 @@ AP[3]: :wlan0-ap-2:Infrastruktura:1:54Mb/s:34:** :WPA1 WPA2
<<<
size: 1973
location: clients/tests/test-client.py:855:test_002()/19
location: clients/tests/test-client.py:857:test_002()/19
cmd: $NMCLI -f ALL d wifi
lang: C
returncode: 0
@ -445,7 +445,7 @@ NAME SSID SSID-HEX BSSID MODE CHAN FREQ RATE SIGNAL BARS SECURITY WPA
<<<
size: 2041
location: clients/tests/test-client.py:855:test_002()/20
location: clients/tests/test-client.py:857:test_002()/20
cmd: $NMCLI -f ALL d wifi
lang: pl_PL.UTF-8
returncode: 0
@ -463,7 +463,7 @@ NAME SSID SSID-HEX BSSID MODE CHAN FREQ RATE SIGNAL BARS SECURITY WPA
<<<
size: 246
location: clients/tests/test-client.py:857:test_002()/21
location: clients/tests/test-client.py:859:test_002()/21
cmd: $NMCLI c
lang: C
returncode: 0
@ -474,7 +474,7 @@ con-1 5fcfd6d7-1e63-3332-8826-a7eda103792d ethernet --
<<<
size: 256
location: clients/tests/test-client.py:857:test_002()/22
location: clients/tests/test-client.py:859:test_002()/22
cmd: $NMCLI c
lang: pl_PL.UTF-8
returncode: 0
@ -485,7 +485,7 @@ con-1 5fcfd6d7-1e63-3332-8826-a7eda103792d ethernet --
<<<
size: 1224
location: clients/tests/test-client.py:859:test_002()/23
location: clients/tests/test-client.py:861:test_002()/23
cmd: $NMCLI c s con-1
lang: C
returncode: 0
@ -517,7 +517,7 @@ connection.llmnr: -1 (default)
<<<
size: 1236
location: clients/tests/test-client.py:859:test_002()/24
location: clients/tests/test-client.py:861:test_002()/24
cmd: $NMCLI c s con-1
lang: pl_PL.UTF-8
returncode: 0

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -748,6 +748,7 @@ class TestNmcli(NmTestBase):
print("EXPECT OUTPUT:\n[[%s]]\n" % (n['content']))
print("Let the test write the file by rerunning with NM_TEST_REGENERATE=1")
print("See howto in %s for details.\n" % (PathConfiguration.canonical_script_filename()))
sys.stdout.flush()
self.fail("Unexpected output of command, expected %s. Rerun test with NM_TEST_REGENERATE=1 to regenerate files" % (filename))
if len(results_expect) != len(results):
if not regenerate:
@ -758,6 +759,7 @@ class TestNmcli(NmTestBase):
print("EXPECT OUTPUT:\n[[%s]]\n" % (results_expect[len(results)]))
print("Let the test write the file by rerunning with NM_TEST_REGENERATE=1")
print("See howto in %s for details.\n" % (PathConfiguration.canonical_script_filename()))
sys.stdout.flush()
self.fail("Unexpected output of command, expected %s. Rerun test with NM_TEST_REGENERATE=1 to regenerate files" % (filename))
if regenerate: