예제 #1
0
 def test_printf(self):
     e = Executable('printf')
     test_string = 'Live as if you were to die tomorrow'
     output = e.run(test_string)
     print(output)
     self.assertEquals(output.stdout, test_string)
예제 #2
0
 def test_cat(self):
     e = Executable('cat')
     output = e.run(dir_path + '/test.txt')
     print(output)
     self.assertEquals(output.stdout, "Hello World\n")
예제 #3
0
 def test_args(self):
     e = Executable(dir_path + '/args.py')
     test_string = 'foobar'
     output = e.run(2, test_string)
     print(output)
     self.assertEquals(output.stdout, test_string + '\n')
예제 #4
0
 def test_exit_status(self):
     e = Executable(dir_path + '/dummy.py')
     output = e.run()
     print(output)
     self.assertEquals(output.exit_status, 42)
예제 #5
0
 def test_stdin(self):
     e = Executable(shutil.which('cat'))
     test_string = 'Live as if you were to die tomorrow'
     output = e.run(stdin=test_string)
     print(output)
     self.assertEquals(output.stdout, test_string)
예제 #6
0
 def test_stderr(self):
     e = Executable(dir_path + '/dummy.py')
     output = e.run()
     print(output)
     self.assertEquals(output.stderr, "an orange\n")
예제 #7
0
 def test_stdout(self):
     e = Executable(dir_path + '/dummy.py')
     output = e.run()
     print(output)
     self.assertEquals(output.stdout, "an apple\n")