Skip to content

Commit 0d3dda4

Browse files
committed
only print if stdout or stderr is not empty
1 parent fbfb37a commit 0d3dda4

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/tests/test_modules.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ class TestBase(unittest.TestCase):
88
def runStudentCode(self, dirname, name):
99
try:
1010
process = subprocess.run(['./run_student_code.sh', dirname], check=True, text=True, capture_output=True, timeout=30)
11-
print(f'{process.stdout.strip()}\n{process.stderr.strip()}'.strip())
11+
if len(process.stdout.strip()) > 0:
12+
print(process.stdout.strip())
13+
if len(process.stderr.strip()) > 0:
14+
print(process.stderr.strip())
1215
except subprocess.CalledProcessError as err:
1316
error_message = str(err.stderr).strip()
1417
raise AssertionError(f'Unable to run student code on {dirname}/{name}.vm: "{error_message}"\n{err.stdout}'.strip())

0 commit comments

Comments
 (0)