def test_positive_02(self): "Requirement contains a tag where no handler exists - multiple tags" mstderr = StringIO.StringIO() init_logger(mstderr) mods = InputModules(os.path.join(mod_base_dir, "modules08"), {}, [], mods_list("modules08", mod_base_dir)) reqs = RequirementSet(None) req = Requirement("Hubbel: bubbel\nSiebel: do", "InvalidTagReq", reqs, mods, TestConfig()) reqs.add_node(RequirementDNode(req)) reqs._handle_modules(mods) lstderr = hide_timestamp(mstderr.getvalue()) lstderr = hide_lineno(lstderr) tear_down_log_handler() result_expected = "===DATETIMESTAMP===;rmtoo;ERROR;RequirementSet;" \ "__all_tags_handled;===SOURCELINENO===; 57:InvalidTagReq:No tag " \ "handler found " \ "for tag(s) '['Siebel', 'Hubbel']' - Hint: typo in tag(s)?\n" \ "===DATETIMESTAMP===;rmtoo;ERROR;RequirementSet;_handle_modules;" \ "===SOURCELINENO===; 56:There were errors encountered during parsing " \ "and checking " \ "- can't continue.\n" self.assertEquals(result_expected, lstderr)
def rmttest_positive_01(self): """Requirement contains a tag where no handler exists""" mstderr = StringIO() init_logger(mstderr) test_config = TestConfig() test_config.set_solved_by() mods = InputModules(test_config) reqs = RequirementSet(None) req = Requirement("Hubbel: bubbel", "hubbel", reqs, mods, test_config) reqs.add_requirement(req) reqs._handle_modules(mods) lstderr = hide_volatile(mstderr.getvalue()) tear_down_log_handler() result_expected \ = ["===DATETIMESTAMP===;rmtoo;ERROR;RequirementSet;" "__all_tags_handled;===LINENO===; 57:hubbel:No tag handler " "found for " "tag(s) '[\"Hubbel\"]' - Hint: typo in tag(s)?", "===DATETIMESTAMP===;rmtoo;ERROR;" "RequirementSet;_handle_modules;" "===LINENO===; 56:There were errors encountered during parsing " "and checking - can't continue."] lstderr_last_two_lines = lstderr.split("\n")[-3:-1] assert result_expected == lstderr_last_two_lines
def test_simple_07(self): "RequirementSet: Module which renders set as errornous" mstderr = StringIO.StringIO() init_logger(mstderr) mods = InputModules(os.path.join(mod_base_dir, "modules07"), {}, [], mods_list("modules07", mod_base_dir)) reqs = RequirementSet(None) reqs._handle_modules(mods) self.assertEqual(reqs.is_usable(), False) lstderr = hide_lineno(hide_timestamp(mstderr.getvalue())) tear_down_log_handler() expected_result = "===DATETIMESTAMP===;rmtoo;ERROR;RequirementSet;" \ "_handle_modules;===SOURCELINENO===; 43:there was a problem handling the " \ "requirement set modules\n" self.assertEqual(lstderr, expected_result)
def rmttest_positive_02(self): "Requirement contains a tag where no handler exists - multiple tags" mstderr = StringIO() init_logger(mstderr) tc = TestConfig() tc.set_solved_by() mods = InputModules(tc) reqs = RequirementSet(None) req = Requirement("Hubbel: bubbel\nSiebel: do", "InvalidTagReq", reqs, mods, tc) reqs.add_requirement(req) reqs._handle_modules(mods) lstderr = hide_volatile(mstderr.getvalue()) tear_down_log_handler() lstderr_last_two_lines = lstderr.split("\n")[-3:-1] result0 \ = re.match( "^===DATETIMESTAMP===;rmtoo;ERROR;RequirementSet;" "__all_tags_handled;===LINENO===; 57:InvalidTagReq:" "No tag handler found " "for tag\(s\) '\[.*\]' - Hint: typo in tag\(s\)\?$", lstderr_last_two_lines[0]) result1 \ = re.match( "^===DATETIMESTAMP===;rmtoo;ERROR;RequirementSet;" "_handle_modules;" "===LINENO===; 56:There were errors encountered " "during parsing " "and checking - can't continue.$", lstderr_last_two_lines[1]) assert result0 assert result1
def rmttest_positive_02(self): "Requirement contains a tag where no handler exists - multiple tags" mstderr = StringIO() init_logger(mstderr) tc = TestConfig() tc.set_solved_by() mods = InputModules(tc) reqs = RequirementSet(None) req = Requirement("Hubbel: bubbel\nSiebel: do", "InvalidTagReq", reqs, mods, tc) reqs.add_requirement(req) reqs._handle_modules(mods) lstderr = hide_volatile(mstderr.getvalue()) tear_down_log_handler() lstderr_last_two_lines = lstderr.split("\n")[-3:-1] result0 \ = re.match( r"^===DATETIMESTAMP===;rmtoo;ERROR;RequirementSet;" r"__all_tags_handled;===LINENO===; 57:InvalidTagReq:" r"No tag handler found " r"for tag\(s\) '\[.*\]' - Hint: typo in tag\(s\)\?$", lstderr_last_two_lines[0]) result1 \ = re.match( r"^===DATETIMESTAMP===;rmtoo;ERROR;RequirementSet;" "_handle_modules;" "===LINENO===; 56:There were errors encountered " "during parsing " "and checking - can't continue.$", lstderr_last_two_lines[1]) assert result0 assert result1