concurrencytest icon indicating copy to clipboard operation
concurrencytest copied to clipboard

RuntimeWarning with respect to line buffering using Python 3.8.

Open mjstahlberg opened this issue 5 years ago • 10 comments

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

mjstahlberg avatar Jul 07 '20 16:07 mjstahlberg

I also have this special kind of warning even if other warnings are suppressed !!!

alan23273850 avatar Jul 31 '20 05:07 alan23273850

The warnings library can suppress all warnings:

import warnings

with warnings.catch_warnings():
    warnings.simplefilter("ignore")
    # invoke test suite

aaronlelevier avatar Jan 12 '21 22:01 aaronlelevier

That workaround silences other warnings as well which can be problematic especially in a testing environment.

mjstahlberg avatar Jan 13 '21 10:01 mjstahlberg

This specific one can be suppressed using the following:

import warnings

warnings.filterwarnings('ignore', '.*line buffering \\(buffering=1\\)')

mariusbalcytis avatar Oct 13 '21 11:10 mariusbalcytis

/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

sjg20 avatar Feb 18 '23 00:02 sjg20

https://github.com/cgoldberg/concurrencytest/pull/15

sjg20 avatar Feb 18 '23 00:02 sjg20

Let's wait and see!

alan23273850 avatar Feb 18 '23 05:02 alan23273850

That PR is identical to my #14 from two years ago. :wink:

mjstahlberg avatar Feb 18 '23 07:02 mjstahlberg

But the authors seem to do nothing?

alan23273850 avatar Feb 18 '23 07:02 alan23273850

The author has not done a public action on GitHub since 2020-05-28.

mjstahlberg avatar Feb 18 '23 07:02 mjstahlberg