def test_cat(self): e = Executable('cat') output = e.run(dir_path + '/test.txt') print(output) self.assertEquals(output.stdout, "Hello World\n")
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')
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)
def test_exit_status(self): e = Executable(dir_path + '/dummy.py') output = e.run() print(output) self.assertEquals(output.exit_status, 42)
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)
def test_stderr(self): e = Executable(dir_path + '/dummy.py') output = e.run() print(output) self.assertEquals(output.stderr, "an orange\n")
def test_stdout(self): e = Executable(dir_path + '/dummy.py') output = e.run() print(output) self.assertEquals(output.stdout, "an apple\n")
def test_config_file(self, name='foobar'): executable = os.path.join(dir_path, 'test_full', 'main.py') config = os.path.join(dir_path, 'test_full', 'tests.yml') print(executable) Tests(path=config, executable=Executable(executable))