def test_qa_call_check_rst_file_clean_failure(self, captured_output): try: check_rst_files() except ValueError: message = 'Output Failed' self.assertIn(message, captured_output.getvalue()) except (SystemExit): pass else: self.fail('SystemExit not raised')
def test_qa_call_check_rst_file_clean_failure(self): captured_output = io.StringIO() sys.stdout = captured_output # redirect stdout try: check_rst_files() except ValueError: message = 'Output Failed' self.assertIn(message, captured_output.getvalue()) except (SystemExit): pass else: self.fail('SystemExit not raised') finally: sys.stdout = sys.__stdout__ # reset redirect
def test_qa_call_check_rst_file_syntax(self): with open(self._test_rst_file, 'a+') as f: f.write('Test File \n======= \n.. code:: python') with self.assertRaises(SystemExit): check_rst_files()