File tree Expand file tree Collapse file tree 3 files changed +20
-4
lines changed
Expand file tree Collapse file tree 3 files changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ In progress (unreleased)
2424* :gh:issue: `1306 ` CI: Report sudo version on Ansible targets
2525* :gh:issue: `1306 ` CI: Move sudo test users defaults into ``/etc/sudoers.d ``
2626* :gh:issue: `1306 ` preamble_size: Fix variability of measured command size
27+ * :gh:issue: `1306 ` tests: Count bytes written in ``stdio_test.StdIOTest ``
2728
2829
2930v0.3.27 (2025-08-20)
Original file line number Diff line number Diff line change 33import sys
44
55
6+ def _shout_stdout_py3 (size ):
7+ nwritten = sys .stdout .write ('A' * size )
8+ return nwritten
9+
10+
11+ def _shout_stdout_py2 (size ):
12+ shout = 'A' * size
13+ nwritten = 0
14+ while nwritten < size :
15+ nwritten += os .write (sys .stdout .fileno (), shout [- nwritten :])
16+ return nwritten
17+
18+
619def shout_stdout (size ):
7- sys .stdout .write ('A' * size )
8- return 'success'
20+ if sys .version_info > (3 , 0 ):
21+ return _shout_stdout_py3 (size )
22+ else :
23+ return _shout_stdout_py2 (size )
924
1025
1126def file_is_blocking (fobj ):
Original file line number Diff line number Diff line change @@ -15,8 +15,8 @@ def test_can_write_stdout_1_mib(self):
1515 """
1616 size = 1 * 2 ** 20
1717 context = self .router .local ()
18- result = context .call (stdio_checks .shout_stdout , size )
19- self .assertEqual ('success' , result )
18+ nwritten = context .call (stdio_checks .shout_stdout , size )
19+ self .assertEqual (nwritten , size )
2020
2121 def test_stdio_is_blocking (self ):
2222 context = self .router .local ()
You can’t perform that action at this time.
0 commit comments