mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-19 19:03:07 +02:00
Tests: Create compat.py for Python 3 compatibility
Individual tests are not yet fully compatible with Python 3. Some still have issues with I/O encoding/decoding. The painful part...
This commit is contained in:
parent
341b528980
commit
3c7187d801
3 changed files with 15 additions and 10 deletions
|
@ -10,6 +10,7 @@ import unittest
|
|||
from .exceptions import CommandError
|
||||
from .hooks import Hooks
|
||||
from .utils import run_cmd_wait, run_cmd_wait_nofail, which, task_binary_location
|
||||
from .compat import STRING_TYPE
|
||||
|
||||
|
||||
class Task(object):
|
||||
|
@ -163,14 +164,7 @@ class Task(object):
|
|||
argument. The string is literally the same as if written in the shell.
|
||||
"""
|
||||
# Enable nicer-looking calls by allowing plain strings
|
||||
try:
|
||||
# Python 2.x
|
||||
type_check = basestring
|
||||
except NameError:
|
||||
# Python 3.x
|
||||
type_check = str
|
||||
|
||||
if isinstance(args, type_check):
|
||||
if isinstance(args, STRING_TYPE):
|
||||
args = shlex.split(args)
|
||||
|
||||
return args
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue