mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Tests: More Python 3 compatibility changes
This commit is contained in:
parent
ce4f67e1bd
commit
341b528980
1 changed files with 8 additions and 2 deletions
|
@ -9,7 +9,10 @@ import atexit
|
||||||
import tempfile
|
import tempfile
|
||||||
from subprocess import Popen, PIPE, STDOUT
|
from subprocess import Popen, PIPE, STDOUT
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
|
try:
|
||||||
from Queue import Queue, Empty
|
from Queue import Queue, Empty
|
||||||
|
except ImportError:
|
||||||
|
from queue import Queue, Empty
|
||||||
from time import sleep
|
from time import sleep
|
||||||
try:
|
try:
|
||||||
import simplejson as json
|
import simplejson as json
|
||||||
|
@ -144,6 +147,9 @@ def _queue_output(arguments, pidq, outputq):
|
||||||
# Send input and wait for finish
|
# Send input and wait for finish
|
||||||
out, err = proc.communicate(input)
|
out, err = proc.communicate(input)
|
||||||
|
|
||||||
|
if sys.version_info > (3,):
|
||||||
|
out, err = out.decode('utf-8'), err.decode('utf-8')
|
||||||
|
|
||||||
# Give the output back to the caller
|
# Give the output back to the caller
|
||||||
outputq.put((out, err, proc.returncode))
|
outputq.put((out, err, proc.returncode))
|
||||||
|
|
||||||
|
@ -470,7 +476,7 @@ def mkstemp_exec(data):
|
||||||
"""Create a temporary executable file that is removed at process exit
|
"""Create a temporary executable file that is removed at process exit
|
||||||
"""
|
"""
|
||||||
name = mkstemp(data)
|
name = mkstemp(data)
|
||||||
os.chmod(name, 0755)
|
os.chmod(name, 0o755)
|
||||||
|
|
||||||
return name
|
return name
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue