if not isinstance(bufsize, int):
raise TypeError("bufsize must be an integer")
+ if stdout is STDOUT:
+ raise ValueError("STDOUT can only be used for stderr")
+
if pipesize is None:
pipesize = -1 # Restore default
if not isinstance(pipesize, int):
self.assertIn(b'BDFL', cp.stdout)
self.assertIn(b'FLUFL', cp.stderr)
+ def test_stdout_stdout(self):
+ # run() refuses to accept stdout=STDOUT
+ with self.assertRaises(ValueError,
+ msg=("STDOUT can only be used for stderr")):
+ self.run_python("print('will not be run')",
+ stdout=subprocess.STDOUT)
+
def test_stdout_with_capture_output_arg(self):
# run() refuses to accept 'stdout' with 'capture_output'
tf = tempfile.TemporaryFile()