def test_error(self): import pylint_pycharm.convertor as convertor import StringIO help_text = "This is help test" convertor.HELP_TEXT = help_text original_parse_module_name = convertor.parse_module_name convertor.parse_module_name = MainTest.parse_module_name_mock io = StringIO.StringIO() convertor.convert([], io) result = io.getvalue() convertor.parse_module_name = original_parse_module_name expected_result = "Error: exception\n"+help_text self.assertEqual(expected_result, result)
def test_success(self): """ successful scenario """ import pylint_pycharm.convertor as convertor import StringIO io = StringIO.StringIO() sample = "%ssample.py" % PROJECT_FOLDER args = ["convertor.py", sample, "--reports=n", "--output-format=parseable"] expected_result = "%ssample.py:6:[06]: \\[[^]]*\\] More than one statement on a single line\n" % ROOT_FOLDER convertor.convert(args, io) result = io.getvalue() self.assertRegexpMatches(result, expected_result)