summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2017-08-19 21:20:23 +0300
committerLars Wirzenius <liw@liw.fi>2017-08-19 21:20:23 +0300
commit9f0b3904c9170a6e9ffec152bb55b47e8eac062b (patch)
tree3057ee6ac3defaf11d59398a30b4a9a2959beb73
parentdc64227be0c0a8c62dfef926d9c4d6d6045baf92 (diff)
downloadcliapp-9f0b3904c9170a6e9ffec152bb55b47e8eac062b.tar.gz
Add: PYthon3 support
-rw-r--r--cliapp/runcmd_tests.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/cliapp/runcmd_tests.py b/cliapp/runcmd_tests.py
index a599dd5..f17afa6 100644
--- a/cliapp/runcmd_tests.py
+++ b/cliapp/runcmd_tests.py
@@ -15,6 +15,7 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+from __future__ import unicode_literals
import os
import subprocess
@@ -85,10 +86,10 @@ class RuncmdTests(unittest.TestCase):
def test_runcmd_redirects_stdin_from_file(self):
fd, _ = tempfile.mkstemp()
- os.write(fd, 'foobar')
+ os.write(fd, 'foobar'.encode()) # send encoded data to stdin
os.lseek(fd, 0, os.SEEK_SET)
self.assertEqual(cliapp.runcmd_unchecked(['cat'], stdin=fd),
- (0, 'foobar', ''))
+ (0, 'foobar', '')) # runcmd will decode stdout
os.close(fd)
def test_runcmd_redirects_stdout_to_file(self):