From 8d894af7e30cc2130d4b5452ab76a51a2675dbe7 Mon Sep 17 00:00:00 2001 From: Iryna Shcherbina Date: Feb 17 2017 00:21:35 +0000 Subject: Fix TypeError under Python 3.5 --- diff --git a/pytest_beakerlib.py b/pytest_beakerlib.py index 7c4e686..426c28b 100644 --- a/pytest_beakerlib.py +++ b/pytest_beakerlib.py @@ -27,7 +27,8 @@ import pytest def shell_quote(string): - return "'" + string.replace("'", "'\\''") + "'" + quote = "'" + string.replace("'", "'\\''") + "'" + return quote.encode('utf-8') def pytest_addoption(parser): @@ -75,10 +76,11 @@ class BeakerLibProcess(object): """Given a command as a Popen-style list, run it in the Bash process""" if not self.bash: return + for word in cmd: self.bash.stdin.write(shell_quote(word)) - self.bash.stdin.write(' ') - self.bash.stdin.write('\n') + self.bash.stdin.write(b' ') + self.bash.stdin.write(b'\n') self.bash.stdin.flush() assert self.bash.returncode is None, "BeakerLib Bash process exited"