File tree Expand file tree Collapse file tree 3 files changed +9
-13
lines changed Expand file tree Collapse file tree 3 files changed +9
-13
lines changed Original file line number Diff line number Diff line change 33import shutil
44import time as t
55from os .path import join as pjoin
6-
7- try :
8- from io import StringIO # Python 3
9- except ImportError :
10- from StringIO import StringIO # Python 2
6+ from io import StringIO , open
117
128import tempfile
139from nose .tools import assert_true , assert_equal
@@ -47,11 +43,11 @@ def test_get_commands_from_file():
4743 commands = ["command1 arg1 arg2" ,
4844 "command2" ,
4945 "command3 arg1 arg2 arg3 arg4" ]
50- fileobj = StringIO ("\n " .join (commands ))
46+ fileobj = StringIO (u "\n " .join (commands ))
5147 assert_array_equal (smartdispatch .get_commands_from_file (fileobj ), commands )
5248
5349 # Test stripping last line if empty
54- fileobj = StringIO ("\n " .join (commands ) + "\n " )
50+ fileobj = StringIO (u "\n " .join (commands ) + u "\n " )
5551 assert_array_equal (smartdispatch .get_commands_from_file (fileobj ), commands )
5652
5753
Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ def test_open_with_lock():
7575
7676 stdout , stderr = process .communicate ()
7777 assert_equal (stdout , b"" )
78- assert_true ("write-lock" in stderr , msg = "Forcing a race condition, try increasing sleeping time above." )
79- assert_true ("Traceback" not in stderr , msg = "Unexpected error: " + stderr ) # Check that there are no errors.
78+ assert_true ("write-lock" in stderr . decode () , msg = "Forcing a race condition, try increasing sleeping time above." )
79+ assert_true ("Traceback" not in stderr . decode () , msg = "Unexpected error: " + stderr . decode () ) # Check that there are no errors.
8080
8181 shutil .rmtree (temp_dir )
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ def setUp(self):
2222 self .command_manager = CommandManager (os .path .join (self ._commands_dir , "commands.txt" ))
2323 self .command_manager .set_commands_to_run (self .commands )
2424
25- self .commands_uid = map (utils .generate_uid_from_string , self .commands )
25+ self .commands_uid = list ( map (utils .generate_uid_from_string , self .commands ) )
2626
2727 def tearDown (self ):
2828 shutil .rmtree (self ._commands_dir )
@@ -111,6 +111,6 @@ def test_lock(self):
111111 time .sleep (1 )
112112
113113 stdout , stderr = process .communicate ()
114- assert_equal (stdout , "" )
115- assert_true ("write-lock" in stderr , msg = "Forcing a race condition, try increasing sleeping time above." )
116- assert_true ("Traceback" not in stderr ) # Check that there are no errors.
114+ assert_equal (stdout , b "" )
115+ assert_true ("write-lock" in stderr . decode () , msg = "Forcing a race condition, try increasing sleeping time above." )
116+ assert_true ("Traceback" not in stderr . decode () ) # Check that there are no errors.
You can’t perform that action at this time.
0 commit comments