Beispiel #1
0
    def test_positive_05(self):
        "MemLogStore: Check error msg - only message - easy cmp"

        mls = MemLogStore()
        mls.error(77, "ErrMsg")

        print("1111 [%s]" % mls.to_list())
        print("2222 [%s]" % MemLogStore.create_mls(
                [ [77, LogLevel.error(), "ErrMsg"] ]).to_list())

        assert(mls == MemLogStore.create_mls(
                [ [77, LogLevel.error(), "ErrMsg"] ]))
Beispiel #2
0
    def test_positive_08(self):
        "MemLogStore: Check error msg - file and line"

        mls = MemLogStore()
        mls.error(77, "ErrMsg", "EFile", "ELine")
        assert(mls == MemLogStore.create_mls(
                [ [77, LogLevel.error(), "ErrMsg", "EFile", "ELine"] ]))
Beispiel #3
0
    def test_positive_07(self):
        "MemLogStore: Check error msg - line - easy cmp"

        mls = MemLogStore()
        mls.error(77, "ErrMsg", None, "ELine")
        assert(mls == MemLogStore.create_mls(
                [ [77, LogLevel.error(), "ErrMsg", None, "ELine"] ]))
Beispiel #4
0
    def test_positive_01(self):
        "Requirement contains a tag where no handler exists"

        mods = Modules(os.path.join(mod_base_dir, "modules08"),
                       {}, [], mods_list("modules08", mod_base_dir))

        sio = StringIO.StringIO("Hubbel: bubbel")
        req = Requirement(sio, "hubbel", None, mods, TestConfig())

        reqs = RequirementSet(mods, None)
        reqs.add_req(req)
        reqs.handle_modules()

        assert(reqs.mls() == MemLogStore.create_mls(
                [[57, LogLevel.error(), "No tag handler found for tag(s) "
                  "'['Hubbel']' - Hint: typo in tag(s)?", 'hubbel'],
                 [56, LogLevel.error(), "There were errors encountered during "
                  "parsing and checking - can't continue"] ]))
 def rh_one_commit(self, cs, ci):
     rs = RequirementSet(cs.mods, cs.config)
     rs.set_version_id(ci.hexsha)
     try:
         files = ci.tree[self.reqs_subdir].blobs
     except KeyError, ke:
         # This means, that at this point of time the directory was
         # not available.
         # TODO: Why not rs.error()????
         rs.log(46, LogLevel.error(), "Path '%s' not available" %
                self.reqs_subdir)
         rs.not_usable()
         return
Beispiel #6
0
    def test_positive_02(self):
        "Requirement contains a tag where no handler exists - multiple tags"

        mods = Modules(os.path.join(mod_base_dir, "modules08"),
                       {}, [], mods_list("modules08", mod_base_dir))

        sio = StringIO.StringIO("Hubbel: bubbel\nSiebel: do")
        req = Requirement(sio, "InvalidTagReq", None, mods, TestConfig())

        reqs = RequirementSet(mods, None)
        reqs.add_req(req)
        reqs.handle_modules()

        #o = StringIO.StringIO()
        #reqs.write_log(o)
        #print("HHHHHHHHHHH %s" % o.getvalue())

        assert(reqs.mls() == MemLogStore.create_mls(
                [[57, LogLevel.error(), "No tag handler found for tag(s) "
                  "'['Siebel', 'Hubbel']' - Hint: typo in tag(s)?",
                  'InvalidTagReq'],
                 [56, LogLevel.error(), "There were errors encountered during "
                  "parsing and checking - can't continue"]]))
Beispiel #7
0
    def test_negative_02(self):
        "Normal requirement has empty 'Solved by'"
        config, reqset = create_parameters()
        reqset.reqs = {
            "A": TestReq("A",
                         {"Type": Requirement.rt_master_requirement},
                         {}),
            "B": TestReq("B",
                         {"Type": Requirement.rt_requirement},
                         {"Solved by": RecordEntry("Solved by", "")})}

        config.set_solved_by()
        rdep = RDepSolvedBy(config)
        status = rdep.rewrite(reqset)

        assert(status == False)
        assert(reqset.mls() == MemLogStore.create_mls(
                [ [77, LogLevel.error(), "'Solved by' field has len 0", "B"] ]))
Beispiel #8
0
    def test_negative_01(self):
        "Two nodes as master requirement"
        config, reqset = create_parameters()
        reqset.reqs = {
            "A": TestReq("A",
                         {"Type": Requirement.rt_master_requirement},
                         {}),
            "B": TestReq("B",
                         {"Type": Requirement.rt_master_requirement},
                         {})}

        config.set_solved_by()
        rdep = RDepSolvedBy(config)
        status = rdep.rewrite(reqset)
        assert(status == False)
        assert(reqset.mls() == MemLogStore.create_mls(
                [ [76, LogLevel.error(), "Another master is already there. "
                   "There can only be one.", "B"] ]))
Beispiel #9
0
    def test_negative_05(self):
        "Set without any master requirement"
        config, reqset = create_parameters()
        reqset.reqs = {
            "A": TestReq("A",
                         {"Type": Requirement.rt_requirement},
                         {"Solved by": RecordEntry("Solved by", "B")}),
            "B": TestReq("B",
                         {"Type": Requirement.rt_requirement},
                         {"Solved by": RecordEntry("Solved by", "A")})}

        config.set_solved_by()
        rdep = RDepSolvedBy(config)
        status = rdep.rewrite(reqset)

        assert(status == False)
        assert(reqset.mls() == MemLogStore.create_mls(
                [[78, LogLevel.error(), "no master requirement found"], ]))
Beispiel #10
0
    def test_negative_04(self):
        "'Solved by' points to same requirement"
        config, reqset = create_parameters()
        reqset.reqs = {
            "A": TestReq("A",
                         {"Type": Requirement.rt_master_requirement},
                         {}),
            "B": TestReq("B",
                         {"Type": Requirement.rt_requirement},
                         {"Solved by": RecordEntry("Solved by", "B")})}

        config.set_solved_by()
        rdep = RDepSolvedBy(config)
        status = rdep.rewrite(reqset)

        assert(status == False)
        assert(reqset.mls() == MemLogStore.create_mls(
                [[75, LogLevel.error(), "'Solved by' points to the requirement "
                  "itself", "B" ], ]))