concurrencytest
concurrencytest copied to clipboard
RuntimeWarning with respect to line buffering using Python 3.8.
I'm getting the following warning using Python 3.8.3 and concurrencytest 0.1.2:
Traceback (most recent call last):
File "./test.py", line 191, in <module>
result = testRunner.run(testSuite)
File "/usr/lib/python3.8/unittest/runner.py", line 176, in run
test(result)
File "/usr/lib/python3.8/unittest/suite.py", line 84, in __call__
return self.run(*args, **kwds)
File "/usr/lib/python3.8/site-packages/testtools/testsuite.py", line 83, in run
tests = self.make_tests(self)
File "/usr/lib/python3.8/site-packages/concurrencytest.py", line 96, in do_fork
stream = os.fdopen(c2pread, 'rb', 1)
File "/usr/lib/python3.8/os.py", line 1023, in fdopen
return io.open(fd, *args, **kwargs)
RuntimeWarning: line buffering (buffering=1) isn't supported in binary mode, the default buffer size will be used
I also have this special kind of warning even if other warnings are suppressed !!!
The warnings library can suppress all warnings:
import warnings
with warnings.catch_warnings():
warnings.simplefilter("ignore")
# invoke test suite
That workaround silences other warnings as well which can be problematic especially in a testing environment.
This specific one can be suppressed using the following:
import warnings
warnings.filterwarnings('ignore', '.*line buffering \\(buffering=1\\)')
/usr/lib/python3.10/os.py:1029: RuntimeWarning: line buffering (buffering=1) isn't supported in binary mode, the default buffer size will be used return io.open(fd, mode, buffering, encoding, *args, **kwargs)
Can we remove line buffering from the os.fdopen() call here ?
https://github.com/cgoldberg/concurrencytest/blob/master/concurrencytest.py#L72
https://github.com/cgoldberg/concurrencytest/pull/15
Let's wait and see!
That PR is identical to my #14 from two years ago. :wink:
But the authors seem to do nothing?
The author has not done a public action on GitHub since 2020-05-28.