diff --git a/codejail/tests/test_jail_code.py b/codejail/tests/test_jail_code.py index 104d57a1..f11fde9e 100644 --- a/codejail/tests/test_jail_code.py +++ b/codejail/tests/test_jail_code.py @@ -89,12 +89,14 @@ def test_ends_with_exception(self): res = jailpy(code="""raise Exception('FAIL')""") self.assertNotEqual(res.status, 0) self.assertEqual(res.stdout, b"") - self.assertEqual(res.stderr, bytes(textwrap.dedent("""\ - Traceback (most recent call last): - File "jailed_code", line 1, in - raise Exception('FAIL') + + regex = textwrap.dedent(""" + (?m)Traceback [(]most recent call last[)]: + File "(/.*?/)?jailed_code", line 1, in + raise Exception[(]'FAIL'[)] Exception: FAIL - """), 'utf-8')) + """).strip() + "\n" + self.assertRegex(res.stderr.decode('utf-8'), regex) def test_stdin_is_provided(self): res = jailpy(