def assertFixtureOutput(self, expected: PhaseFile, result: Result) -> None:
     """
     Asserts that the given stdout/stderr from the simple compiler matches
     the expected output from the `PhaseFile`.
     """
     # Wrap assertion errors in the exact command to invoke
     # (that can be copied and pasted) for convenience
     with assertion_context("while running: {}\n\n".format(result.cmd)):
         self.assertFixtureStdout(expected, result)
         self.assertFixtureStderr(expected, result)
Exemplo n.º 2
0
 def test_assertion_context_with_raise_assert(self):
     with self.assertRaisesRegex(AssertionError, 'foo bar'):
         with assertion_context('foo '):
             assert False, 'bar'
Exemplo n.º 3
0
 def test_assertion_context_with_no_raise(self):
     with assertion_context('foo '):
         pass
Exemplo n.º 4
0
 def test_assertion_context_with_raise_other(self):
     with self.assertRaisesRegex(Exception, 'something'):
         with assertion_context('foo '):
             raise Exception('something')