Exemple #1
0
    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)
Exemple #2
0
    def test_neg_point_to_self(self):
        "'Solved by' points to same requirement"
        mstderr = StringIO.StringIO()
        init_logger(mstderr)

        config = TestConfig()
        reqset = RequirementSet(config)
        req1 = Requirement('''Name: A
Type: master requirement''', 'A', None, None, None)
        reqset.add_node(RequirementDNode(req1))
        req2 = Requirement('''Name: B
Type: requirement
Solved by: B''', 'B', None, None, None)
        reqset.add_node(RequirementDNode(req2))
        config.set_solved_by()
        rdep = RDepSolvedBy(config)
        status = rdep.rewrite(reqset)

        self.assertFalse(status)
        lstderr = hide_lineno(hide_timestamp(mstderr.getvalue()))
        tear_down_log_handler()
        result_expected = "===DATETIMESTAMP===;rmtoo;ERROR;RequirementSet;" \
        "__resolve_solved_by_one_req;===SOURCELINENO===; 75:B:'Solved by' " \
        "points to the requirement itself\n"
        self.assertEquals(result_expected, lstderr)
Exemple #3
0
    def test_neg_05(self):
        "TestRecordTxt2: long long line - check for lineno"
        mstderr = StringIO.StringIO()
        init_logger(mstderr)

        cfg = Cfg.new_by_json_str('{"max_input_line_length": 7}')
        tioconfig = TxtIOConfig(cfg)
        txt_doc = TxtRecord.from_string(
            """# com
ok: yes
 no
# cs
# dds
good: but too long
# dds

""", "TooLong", tioconfig)

        self.assertEqual(txt_doc.is_usable(), False)
        lstderr = hide_timestamp(mstderr.getvalue())
        tear_down_log_handler()

        result_expected = "===DATETIMESTAMP===;rmtoo;ERROR;TxtRecord;" \
        "check_line_length;77; 80:TooLong:6:line too long: is [18], " \
        "max allowed [7]\n"
        self.assertEquals(result_expected, lstderr)
Exemple #4
0
    def test_json_init_add_new_cmd_line_params(self):
        '''Init Cfg with JSON and adds parameters with command line options'''
        mstderr = StringIO.StringIO()
        init_logger(mstderr)

        # Create two JSON files.
        tmpdir = create_tmp_dir()
        jsonfile1 = os.path.join(tmpdir, "config1.json")
        jsonfd1 = file(jsonfile1, "w")
        jsonfd1.write(json.dumps({'k': 2, 'm': {'n': 5}, 'o': 7}))
        jsonfd1.close()
        jsonfile2 = os.path.join(tmpdir, "config2.json")
        jsonfd2 = file(jsonfile2, "w")
        jsonfd2.write(json.dumps({'k': 3, 'm': {'w': 11}, 'p': 9}))
        jsonfd2.close()

        config = Cfg.new_by_json_str('{"k": 1, "l": [2, 3], "m": {"n": 4}}')
        config.merge_cmd_line_params([
            '-j', '{"m": {"p": 99}}', '-j', 'file://' + jsonfile1, '-j',
            '{"m": {"q": 100}}', '-j', 'file://' + jsonfile2
        ])
        self.failUnlessEqual(1, config.get_value("k"), "k is not 1")
        config.evaluate()
        self.failUnlessEqual(3, config.get_value("k"), "k is not 3")
        self.failUnlessEqual(11, config.get_value("m.w"))
        lstderr = hide_timestamp(mstderr.getvalue())
        tear_down_log_handler()
        self.failUnlessEqual(lstderr, "")
Exemple #5
0
    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)
Exemple #6
0
    def test_neg_05(self):
        "TestRecordTxt2: long long line - check for lineno"
        mstderr = StringIO.StringIO()
        init_logger(mstderr)

        cfg = Cfg.new_by_json_str('{"max_input_line_length": 7}')
        tioconfig = TxtIOConfig(cfg)
        txt_doc = TxtRecord.from_string("""# com
ok: yes
 no
# cs
# dds
good: but too long
# dds

""",
                                        "TooLong", tioconfig)

        self.assertEqual(txt_doc.is_usable(), False)
        lstderr = hide_timestamp(mstderr.getvalue())
        tear_down_log_handler()
        
        result_expected = "===DATETIMESTAMP===;rmtoo;ERROR;TxtRecord;" \
        "check_line_length;77; 80:TooLong:6:line too long: is [18], " \
        "max allowed [7]\n"
        self.assertEquals(result_expected, lstderr)
    def test_neg_point_to_self(self):
        "'Solved by' points to same requirement"
        mstderr = StringIO.StringIO()
        init_logger(mstderr)

        config = TestConfig()
        reqset = RequirementSet(config)
        req1 = Requirement('''Name: A
Type: master requirement''', 'A', None, None, None)
        reqset.add_node(RequirementDNode(req1))
        req2 = Requirement('''Name: B
Type: requirement
Solved by: B''', 'B', None, None, None)
        reqset.add_node(RequirementDNode(req2))
        config.set_solved_by()
        rdep = RDepSolvedBy(config)
        status = rdep.rewrite(reqset)

        self.assertFalse(status)
        lstderr = hide_lineno(hide_timestamp(mstderr.getvalue()))
        tear_down_log_handler()
        result_expected = "===DATETIMESTAMP===;rmtoo;ERROR;RequirementSet;" \
        "__resolve_solved_by_one_req;===SOURCELINENO===; 75:B:'Solved by' " \
        "points to the requirement itself\n"
        self.assertEquals(result_expected, lstderr)
    def test_json_init_add_new_cmd_line_params(self):
        '''Init Cfg with JSON and adds parameters with command line options'''
        mstderr = StringIO.StringIO()
        init_logger(mstderr)

        # Create two JSON files.
        tmpdir = create_tmp_dir()
        jsonfile1 = os.path.join(tmpdir, "config1.json")
        jsonfd1 = file(jsonfile1, "w")
        jsonfd1.write(json.dumps({'k': 2 , 'm': {'n': 5}, 'o': 7}))
        jsonfd1.close()
        jsonfile2 = os.path.join(tmpdir, "config2.json")
        jsonfd2 = file(jsonfile2, "w")
        jsonfd2.write(json.dumps({'k': 3 , 'm': {'w': 11}, 'p': 9}))
        jsonfd2.close()

        config = Cfg.new_by_json_str('{"k": 1, "l": [2, 3], "m": {"n": 4}}');
        config.merge_cmd_line_params(['-j', '{"m": {"p": 99}}',
                                      '-j', 'file://' + jsonfile1,
                                      '-j', '{"m": {"q": 100}}',
                                      '-j', 'file://' + jsonfile2])
        self.failUnlessEqual(1, config.get_value("k"), "k is not 1")
        config.evaluate()
        self.failUnlessEqual(3, config.get_value("k"), "k is not 3")
        self.failUnlessEqual(11, config.get_value("m.w"))
        lstderr = hide_timestamp(mstderr.getvalue())
        tear_down_log_handler()
        self.failUnlessEqual(lstderr, "")
Exemple #9
0
def prepare_stderr():
    '''Some lines of the stderr contain a date / timestamp.
       This must be unified in order to be able to compare them.'''
    mstderr = file(os.path.join(os.environ["rmtoo_test_dir"], "stderr"))
    lines = mstderr.readlines()
    mstderr.close()

    new_stderr = file(os.path.join(os.environ["rmtoo_test_dir"], "stderr"), "w")
    for line in lines:
        new_stderr.write("%s" % hide_lineno(hide_timestamp(line)))
    new_stderr.close()
Exemple #10
0
def prepare_stderr():
    '''Some lines of the stderr contain a date / timestamp.
       This must be unified in order to be able to compare them.'''
    mstderr = file(os.path.join(os.environ["rmtoo_test_dir"], "stderr"))
    lines = mstderr.readlines()
    mstderr.close()

    new_stderr = file(os.path.join(os.environ["rmtoo_test_dir"], "stderr"),
                      "w")
    for line in lines:
        new_stderr.write("%s" % hide_lineno(hide_timestamp(line)))
    new_stderr.close()
Exemple #11
0
    def test_neg_01(self):
        "BaseRMObject: check for module which has wrong type"

        mstderr = StringIO.StringIO()
        init_logger(mstderr)

        tbrmo = TBRMObj()

        result = hide_lineno(hide_timestamp(mstderr.getvalue()))
        tear_down_log_handler()

        self.assertEqual(result, expected_result)
Exemple #12
0
    def test_neg_01(self):
        "TestRecordTxt2: rubbish in input"
        mstderr = StringIO.StringIO()
        init_logger(mstderr)
        txt_doc = TxtRecord.from_string("rubbish", "Rubbish", TxtIOConfig())

        self.assertEqual(txt_doc.is_usable(), False)
        lstderr = hide_timestamp(mstderr.getvalue())
        tear_down_log_handler()
        result_expected = "===DATETIMESTAMP===;rmtoo;ERROR;TxtParser;" \
        "split_entries;125; 79:Rubbish:1:Expected tag line not found\n"
        self.assertEquals(result_expected, lstderr)
Exemple #13
0
    def test_neg_02(self):
        "TestRecordTxt2: only ':'"
        mstderr = StringIO.StringIO()
        init_logger(mstderr)

        txt_doc = TxtRecord.from_string(":", "Rubbish", TxtIOConfig())
        self.assertEqual(txt_doc.is_usable(), False)
        lstderr = hide_timestamp(mstderr.getvalue())
        tear_down_log_handler()
        
        result_expected = "===DATETIMESTAMP===;rmtoo;ERROR;TxtParser;" \
        "split_entries;125; 79:Rubbish:1:Expected tag line not found\n"
        self.assertEquals(result_expected, lstderr)
Exemple #14
0
    def test_neg_08(self):
        "TestRecordTxt2: only intro content line"
        mstderr = StringIO.StringIO()
        init_logger(mstderr)

        tioconfig = TxtIOConfig()
        txt_doc = TxtRecord.from_string("#1 com", "OnlyEntryComment",
                                        tioconfig)

        self.assertEqual(txt_doc.is_usable(), True)
        self.assertEqual(txt_doc.get_comment(), "1 com\n")
        lstderr = hide_timestamp(mstderr.getvalue())
        tear_down_log_handler()

        self.assertEquals("", lstderr)
Exemple #15
0
    def test_neg_08(self):
        "TestRecordTxt2: only intro content line"
        mstderr = StringIO.StringIO()
        init_logger(mstderr)

        tioconfig = TxtIOConfig()
        txt_doc = TxtRecord.from_string("#1 com",
                                        "OnlyEntryComment", tioconfig)

        self.assertEqual(txt_doc.is_usable(), True)
        self.assertEqual(txt_doc.get_comment(), "1 com\n")
        lstderr = hide_timestamp(mstderr.getvalue())
        tear_down_log_handler()
        
        self.assertEquals("", lstderr)
Exemple #16
0
    def test_simple_05(self):
        "Module test with dependent modules"
        mstderr = StringIO.StringIO()
        init_logger(mstderr)

        mods = InputModules(os.path.join(mod_base_dir, "modules05"), {}, [],
                            mods_list("modules05", mod_base_dir))
        req = Requirement("Name: t\n", 77, None, mods, TestConfig())

        lstderr = hide_lineno(hide_timestamp(mstderr.getvalue()))
        tear_down_log_handler()
        self.assertEqual(req.is_usable(), False)
        expected_result = "===DATETIMESTAMP===;rmtoo;ERROR;BaseRMObject;" \
        "handle_modules_tag;===SOURCELINENO===; 54:77:" \
        "tag [SameTag] already defined\n"
        self.assertEqual(lstderr, expected_result)
Exemple #17
0
    def test_simple_05(self):
        "Module test with dependent modules"
        mstderr = StringIO.StringIO()
        init_logger(mstderr)

        mods = InputModules(os.path.join(mod_base_dir, "modules05"),
                       {}, [], mods_list("modules05", mod_base_dir))
        req = Requirement("Name: t\n", 77, None, mods, TestConfig())

        lstderr = hide_lineno(hide_timestamp(mstderr.getvalue()))
        tear_down_log_handler()
        self.assertEqual(req.is_usable(), False)
        expected_result = "===DATETIMESTAMP===;rmtoo;ERROR;BaseRMObject;" \
        "handle_modules_tag;===SOURCELINENO===; 54:77:" \
        "tag [SameTag] already defined\n"
        self.assertEqual(lstderr, expected_result)
Exemple #18
0
    def test_simple_06(self):
        "Requirement: Module test with exception thrown"
        mstderr = StringIO.StringIO()
        init_logger(mstderr)

        mods = InputModules(os.path.join(mod_base_dir, "modules06"), {}, [],
                            mods_list("modules06", mod_base_dir))
        req = Requirement("Name: t\n", 77, None, mods, TestConfig())

        lstderr = hide_lineno(hide_timestamp(mstderr.getvalue()))
        tear_down_log_handler()
        self.assertEqual(req.is_usable(), False)
        expected_result = "===DATETIMESTAMP===;rmtoo;ERROR;BaseRMObject;" \
        "handle_modules_tag;===SOURCELINENO===; 55:TCExcept\n" \
        "===DATETIMESTAMP===;rmtoo;ERROR;BaseRMObject;handle_modules_tag;" \
        "===SOURCELINENO===; 41:77:" \
        "semantic error occurred in module [Module01]\n"
        self.assertEqual(lstderr, expected_result)
Exemple #19
0
    def test_simple_06(self):
        "Requirement: Module test with exception thrown"
        mstderr = StringIO.StringIO()
        init_logger(mstderr)

        mods = InputModules(os.path.join(mod_base_dir, "modules06"),
                       {}, [], mods_list("modules06", mod_base_dir))
        req = Requirement("Name: t\n", 77, None, mods, TestConfig())

        lstderr = hide_lineno(hide_timestamp(mstderr.getvalue()))
        tear_down_log_handler()
        self.assertEqual(req.is_usable(), False)
        expected_result = "===DATETIMESTAMP===;rmtoo;ERROR;BaseRMObject;" \
        "handle_modules_tag;===SOURCELINENO===; 55:TCExcept\n" \
        "===DATETIMESTAMP===;rmtoo;ERROR;BaseRMObject;handle_modules_tag;" \
        "===SOURCELINENO===; 41:77:" \
        "semantic error occurred in module [Module01]\n"
        self.assertEqual(lstderr, expected_result)
Exemple #20
0
    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)
Exemple #21
0
    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)
Exemple #22
0
    def test_neg_06(self):
        "TestRecordTxt2: long long line - check for multiple errors"
        mstderr = StringIO.StringIO()
        init_logger(mstderr)

        cfg = Cfg.new_by_json_str('{"max_input_line_length": 7}')
        tioconfig = TxtIOConfig(cfg)
        txt_doc = TxtRecord.from_string(
            """#1 com
ok: yes
 no
#4 cs
#5 dds
good: but too long
#7 dds
#8 hi
also good: but too long
#10 gsst
 dhd
#12 dhdh 
d:
#14
""", "TooLong", tioconfig)

        self.assertEqual(txt_doc.is_usable(), False)
        lstderr = hide_timestamp(mstderr.getvalue())
        tear_down_log_handler()

        result_expected = "===DATETIMESTAMP===;rmtoo;ERROR;TxtRecord;" \
        "check_line_length;77; 80:TooLong:6:line too long: is [18], " \
        "max allowed [7]\n" \
        "===DATETIMESTAMP===;rmtoo;ERROR;TxtRecord;check_line_length;77; 80:" \
        "TooLong:9:line too long: is [23], max allowed [7]\n" \
        "===DATETIMESTAMP===;rmtoo;ERROR;TxtRecord;check_line_length;77; 80:" \
        "TooLong:10:line too long: is [8], max allowed [7]\n" \
        "===DATETIMESTAMP===;rmtoo;ERROR;TxtRecord;check_line_length;77; 80:" \
        "TooLong:12:line too long: is [9], max allowed [7]\n" \
        "===DATETIMESTAMP===;rmtoo;INFO;TxtParser;split_next_record;84; 80:" \
        "TooLong:11:Compatibility info: Comments will be reordered when " \
        "they are re-written with rmtoo-tools. Please consult " \
        "rmtoo-req-format(5) or rmtoo-topic-format(5)\n"

        self.assertEquals(result_expected, lstderr)
Exemple #23
0
    def test_neg_06(self):
        "TestRecordTxt2: long long line - check for multiple errors"
        mstderr = StringIO.StringIO()
        init_logger(mstderr)

        cfg = Cfg.new_by_json_str('{"max_input_line_length": 7}')
        tioconfig = TxtIOConfig(cfg)
        txt_doc = TxtRecord.from_string("""#1 com
ok: yes
 no
#4 cs
#5 dds
good: but too long
#7 dds
#8 hi
also good: but too long
#10 gsst
 dhd
#12 dhdh 
d:
#14
""",
                                        "TooLong", tioconfig)

        self.assertEqual(txt_doc.is_usable(), False)
        lstderr = hide_timestamp(mstderr.getvalue())
        tear_down_log_handler()
        
        result_expected = "===DATETIMESTAMP===;rmtoo;ERROR;TxtRecord;" \
        "check_line_length;77; 80:TooLong:6:line too long: is [18], " \
        "max allowed [7]\n" \
        "===DATETIMESTAMP===;rmtoo;ERROR;TxtRecord;check_line_length;77; 80:" \
        "TooLong:9:line too long: is [23], max allowed [7]\n" \
        "===DATETIMESTAMP===;rmtoo;ERROR;TxtRecord;check_line_length;77; 80:" \
        "TooLong:10:line too long: is [8], max allowed [7]\n" \
        "===DATETIMESTAMP===;rmtoo;ERROR;TxtRecord;check_line_length;77; 80:" \
        "TooLong:12:line too long: is [9], max allowed [7]\n" \
        "===DATETIMESTAMP===;rmtoo;INFO;TxtParser;split_next_record;84; 80:" \
        "TooLong:11:Compatibility info: Comments will be reordered when " \
        "they are re-written with rmtoo-tools. Please consult " \
        "rmtoo-req-format(5) or rmtoo-topic-format(5)\n"
        
        self.assertEquals(result_expected, lstderr)
    def test_json_init_add_old2_cmd_line_params(self):
        '''Init Cfg with old config and adds parameters with command line options'''
        mstderr = StringIO.StringIO()
        init_logger(mstderr)

        config = Cfg.new_by_json_str('{"k": 1, "l": [2, 3], "m": {"n": 4}}');
        config.merge_cmd_line_params(['-f', 'tests/UnitTest/CoreTests/'
                                      'testdata/Config3.py'])

        self.failUnlessEqual(1, config.get_value("k"), "k is not 1")
        config.evaluate()
        self.failUnlessEqual(['development', 'management', 'users', 'customers'],
                             config.get_value("requirements.stakeholders"))
        lstderr = hide_timestamp(mstderr.getvalue())
        tear_down_log_handler()

        expected_result = "===DATETIMESTAMP===;rmtoo;WARNING;Old;" \
        "internal_convert_to_new;171;100:Old Configuration: " \
        "Not converted attributes: [['output_specs2']]\n"

        self.failUnlessEqual(expected_result, lstderr)
Exemple #25
0
    def test_json_init_add_old2_cmd_line_params(self):
        '''Init Cfg with old config and adds parameters with command line options'''
        mstderr = StringIO.StringIO()
        init_logger(mstderr)

        config = Cfg.new_by_json_str('{"k": 1, "l": [2, 3], "m": {"n": 4}}')
        config.merge_cmd_line_params(
            ['-f', 'tests/UnitTest/CoreTests/'
             'testdata/Config3.py'])

        self.failUnlessEqual(1, config.get_value("k"), "k is not 1")
        config.evaluate()
        self.failUnlessEqual(
            ['development', 'management', 'users', 'customers'],
            config.get_value("requirements.stakeholders"))
        lstderr = hide_timestamp(mstderr.getvalue())
        tear_down_log_handler()

        expected_result = "===DATETIMESTAMP===;rmtoo;WARNING;Old;" \
        "internal_convert_to_new;171;100:Old Configuration: " \
        "Not converted attributes: [['output_specs2']]\n"

        self.failUnlessEqual(expected_result, lstderr)
Exemple #26
0
    def test_neg_07(self):
        "TestRecordTxt2: test comments between content lines"
        mstderr = StringIO.StringIO()
        init_logger(mstderr)

        tioconfig = TxtIOConfig()
        txt_doc = TxtRecord.from_string(
            """#1 com
t1: uuuu
#3 Comment not allowed here.
#4 Should emitt a warning
 vvvv
t2: uuuu
 vvvv
#8 Here a comment is also not allowed
 wwww
t3: uuuu
#11 Same as t1 but with additional 
#12 comment at the end of the requirement
 vvvv
#14 End comment for t3
t4: uuuu
 vvvv
#17 Same as t2 but with additional 
#18 comment at the end of the requirement
 wwww
#20 End comment for t4
""", "CommentsEverywhere", tioconfig)

        self.assertEqual(txt_doc.is_usable(), True)
        lstderr = hide_timestamp(mstderr.getvalue())
        tear_down_log_handler()

        result_expected = comment_line % 5 + comment_line % 9 + \
        comment_line % 13 + comment_line % 19

        self.assertEquals(result_expected, lstderr)
Exemple #27
0
    def test_neg_07(self):
        "TestRecordTxt2: test comments between content lines"
        mstderr = StringIO.StringIO()
        init_logger(mstderr)

        tioconfig = TxtIOConfig()
        txt_doc = TxtRecord.from_string("""#1 com
t1: uuuu
#3 Comment not allowed here.
#4 Should emitt a warning
 vvvv
t2: uuuu
 vvvv
#8 Here a comment is also not allowed
 wwww
t3: uuuu
#11 Same as t1 but with additional 
#12 comment at the end of the requirement
 vvvv
#14 End comment for t3
t4: uuuu
 vvvv
#17 Same as t2 but with additional 
#18 comment at the end of the requirement
 wwww
#20 End comment for t4
""",
                                        "CommentsEverywhere", tioconfig)

        self.assertEqual(txt_doc.is_usable(), True)
        lstderr = hide_timestamp(mstderr.getvalue())
        tear_down_log_handler()
        
        result_expected = comment_line % 5 + comment_line % 9 + \
        comment_line % 13 + comment_line % 19
        
        self.assertEquals(result_expected, lstderr)