def run(runner, args): """ Run test tests and prints out parsed output result in stdout. :param runner: Name of the runner to be used. :param args: List of command arguments for the test runner. """ cmd = get_command(runner).split() cmd.extend(args) # Call tests runner with the current args p = subprocess.Popen( cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, ) stdout, stderr = p.communicate() # In python3, the byte array needs to be decoded back to a string if (sys.version_info > (3, 0)): stdout = stdout.decode() stderr = stderr.decode() output = "".join([stdout, stderr]) parse = get_parse_function(runner) result = parse(output.splitlines()) print("\n".join(result))
def test_get_nose_parse_function(self): self.assertEqual( get_parse_function('nose'), nose_parse, )
def test_get_pytest_parse_function(self): self.assertEqual( get_parse_function('pytest'), pytest_parse, )