##// END OF EJS Templates
Simplify check_handler_with_file
Takafumi Arakaki -
Show More
@@ -62,10 +62,6 b' class ZMQTerminalInteractiveShellTestCase(unittest.TestCase):'
62 assert len(show_called_with) == 1
62 assert len(show_called_with) == 1
63 assert open_called_with[0].getvalue() == self.raw
63 assert open_called_with[0].getvalue() == self.raw
64
64
65 @staticmethod
66 def get_handler_command(inpath, outpath):
67 return [find_cmd('python'), SCRIPT_PATH, inpath, outpath]
68
69 def check_handler_with_file(self, inpath, handler):
65 def check_handler_with_file(self, inpath, handler):
70 shell = self.shell
66 shell = self.shell
71 configname = '{0}_image_handler'.format(handler)
67 configname = '{0}_image_handler'.format(handler)
@@ -75,7 +71,7 b' class ZMQTerminalInteractiveShellTestCase(unittest.TestCase):'
75 assert hasattr(shell, funcname)
71 assert hasattr(shell, funcname)
76
72
77 with NamedFileInTemporaryDirectory('data') as file:
73 with NamedFileInTemporaryDirectory('data') as file:
78 cmd = self.get_handler_command(inpath, file.name)
74 cmd = [find_cmd('python'), SCRIPT_PATH, inpath, file.name]
79 setattr(shell, configname, cmd)
75 setattr(shell, configname, cmd)
80 getattr(shell, funcname)(self.data, self.mime)
76 getattr(shell, funcname)(self.data, self.mime)
81 transferred = file.read()
77 transferred = file.read()
General Comments 0
You need to be logged in to leave comments. Login now