@mock.patch('os.path.isdir', return_value=True)
@mock.patch('subprocess.Popen')
def test_run_ko2(self, *args):
- stream = six.StringIO()
- stream.write("foo")
+ stream = six.BytesIO()
+ stream.write(b"foo")
stream.seek(0)
attrs = {'return_value.stdout': stream, 'return_value.returncode': 1}
args[0].configure_mock(**attrs)
@mock.patch('os.path.isdir', return_value=True)
@mock.patch('subprocess.Popen')
def test_run1(self, *args):
- stream = six.StringIO()
- stream.write("foo")
+ stream = six.BytesIO()
+ stream.write(b"foo")
stream.seek(0)
attrs = {'return_value.stdout': stream, 'return_value.returncode': 0}
args[0].configure_mock(**attrs)
@mock.patch('os.path.isdir', return_value=True)
@mock.patch('subprocess.Popen')
def test_run2(self, *args):
- stream = six.StringIO()
- stream.write("foo")
+ stream = six.BytesIO()
+ stream.write(b"foo")
stream.seek(0)
attrs = {'return_value.stdout': stream, 'return_value.returncode': 0}
args[0].configure_mock(**attrs)
@mock.patch('os.path.isdir', return_value=True)
@mock.patch('subprocess.Popen')
def test_run3(self, *args):
- stream = six.StringIO()
- stream.write("foo")
+ stream = six.BytesIO()
+ stream.write(b"foo")
stream.seek(0)
attrs = {'return_value.stdout': stream, 'return_value.returncode': 0}
args[0].configure_mock(**attrs)
@mock.patch('os.path.isdir', return_value=False)
@mock.patch('subprocess.Popen')
def test_run4(self, *args):
- stream = six.StringIO()
- stream.write("foo")
+ stream = six.BytesIO()
+ stream.write(b"foo")
stream.seek(0)
attrs = {'return_value.stdout': stream, 'return_value.returncode': 0}
args[0].configure_mock(**attrs)
@mock.patch('subprocess.Popen',
return_value=mock.Mock(
- communicate=mock.Mock(return_value=("foo", "bar"))))
+ communicate=mock.Mock(return_value=(b"foo", b"bar"))))
def test_generate_stats_ok(self, *args):
stream = six.StringIO()
self.psrunner.generate_stats(stream)
@mock.patch('subprocess.Popen',
return_value=mock.Mock(
- communicate=mock.Mock(return_value=("foo", "bar"))))
+ communicate=mock.Mock(return_value=(b"foo", b"bar"))))
def test_generate_xunit_ok(self, *args):
stream = six.BytesIO()
with mock.patch('six.moves.builtins.open',