File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -674,7 +674,7 @@ def parse_env_file(env_file):
674
674
675
675
676
676
def split_command (command ):
677
- if six .PY2 :
677
+ if six .PY2 and not isinstance ( command , six . binary_type ) :
678
678
command = command .encode ('utf-8' )
679
679
return shlex .split (command )
680
680
Original file line number Diff line number Diff line change @@ -392,14 +392,18 @@ def test_decode_json_header(self):
392
392
393
393
class SplitCommandTest (base .BaseTestCase ):
394
394
395
- @pytest .mark .skipif (six .PY2 , reason = "shlex doesn't support unicode in py2" )
396
395
def test_split_command_with_unicode (self ):
397
- self .assertEqual (split_command ('echo μ' ), ['echo' , 'μ' ])
396
+ if six .PY2 :
397
+ self .assertEqual (
398
+ split_command (unicode ('echo μμ' , 'utf-8' )),
399
+ ['echo' , 'μμ' ]
400
+ )
401
+ else :
402
+ self .assertEqual (split_command ('echo μμ' ), ['echo' , 'μμ' ])
398
403
399
- @pytest .mark .skipif (six .PY3 , reason = "shlex doesn't support unicode in py2 " )
404
+ @pytest .mark .skipif (six .PY3 , reason = "shlex doesn't support bytes in py3 " )
400
405
def test_split_command_with_bytes (self ):
401
- expected = ['echo' , u'μ' .encode ('utf-8' )]
402
- self .assertEqual (split_command (u'echo μ' ), expected )
406
+ self .assertEqual (split_command ('echo μμ' ), ['echo' , 'μμ' ])
403
407
404
408
405
409
class PortsTest (base .BaseTestCase ):
You can’t perform that action at this time.
0 commit comments