示例#1
0
    def test_pos_01(self):
        "Normalization test"

        def myexit(n):
            self.rval = n

        mout, merr = prepare_result_is_dir()
        td = tmp_dir()

        #print("TD %s" % td)

        # Copy requirements to tmp dir
        destdir = os.path.join(td, "reqs") 
        shutil.copytree("%s/input/reqs" % mdir, destdir,
                        ignore=shutil.ignore_patterns('*~', ))

        # Call the converter
        main(["-f", os.path.join(mdir, "input", "Config2.py"),
              "-m", "..", destdir], mout, merr, main_impl, myexit)

        assert(self.rval==0)

        cleanup_std_log(mout, merr)
        missing_files, additional_files, diffs = compare_results(mdir)
        assert(len(missing_files)==0)
        assert(len(additional_files)==0)
        assert(len(diffs)==0)

        delete_result_is_dir()
示例#2
0
文件: bb005Test.py 项目: apre/rmtoo
    def test_pos_002(self):
        "BB Basic with one requirement - reqs only from FILES"

        def myexit(n):
            pass

        os.environ["basedir"] = mdir
        mout, merr = prepare_result_is_dir()
        main(["-j", "file://" + mdir + "/input/Config.json"], mout, merr,
             exitfun=myexit)
        cleanup_std_log(mout, merr)
#        extract_container_files(["reqspricing.ods", ])
        missing_files, additional_files, diffs = compare_results(mdir)
        assert(len(missing_files) == 0)
        if len(additional_files) != 0:
            print("ADDITIONAL FILES [%s]" % additional_files)
        assert(len(additional_files) == 0)
        # The count stats is always different because of the timestamp

        if len(diffs) != 1:
            print("DIFFS '%s'" % diffs)

        assert(len(diffs) == 1)
        # Diffs are the from the stats count file:
        # ['---  \n', 
        #  '+++  \n', 
        #  '@@ -1,1 +1,5 @@\n', 
        #  '-2010-07-31_06:11:27 1\n', -- or similar
        #  '+2010-07-30_21:04:35 1\n', 
        #  '+2010-07-30_21:03:22 1\n',
        #  '+2010-07-30_20:57:36 1\n',
        #  '+2010-07-29_21:17:15 1\n',
        #  '+2010-07-29_21:09:03 1\n']
        assert(len(diffs["stats_reqs_cnt.csv"]) == 9)
        delete_result_is_dir()
示例#3
0
    def test_pos(self):
        "BB Basic with one requirement - parse error"

        mout, merr = prepare_result_is_dir()
        result = main_impl(["-f", mdir + "/input/Config1.py", "-m", ".."], mout, merr)
        cleanup_std_log(mout, merr)
        missing_files, additional_files, diffs = compare_results(mdir)
        assert result == False
        assert len(missing_files) == 0
        assert len(additional_files) == 0
        assert len(diffs) == 0
        delete_result_is_dir()
示例#4
0
    def test_pos_001(self):
        "BB Basic with one requirement - check log output for typo in topic"

        mout, merr = prepare_result_is_dir()
        result = main_impl(["-f", mdir + "/input/Config1.py", "-m", ".."],
                           mout, merr)
        cleanup_std_log(mout, merr)
        missing_files, additional_files, diffs = compare_results(mdir)
        assert(result==False)
        assert(len(missing_files)==0)
        assert(len(additional_files)==0)
        assert(len(diffs)==0)
        delete_result_is_dir()
示例#5
0
    def test_pos(self):
        "BB Basic with one requirement - bad analytics"

        mout, merr = prepare_result_is_dir()
        result = main_impl(["-f", mdir + "/input/Config1.py", "-m", ".."],
                           mout, merr)
        cleanup_std_log(mout, merr)
        missing_files, additional_files, diffs = compare_results(mdir)
        assert(result==False)

        # WHY : stop on errors is set to True!
        assert(len(missing_files)==0)
        assert(len(additional_files)==0)
        assert(len(diffs)==0)
        delete_result_is_dir()
示例#6
0
    def test_pos_001(self):
        "Blackbox test for simple constraint handling"

        def myexit(n):
            pass

        mout, merr = prepare_result_is_dir()
        main(["-f", mdir + "/input/Config1.py", "-m", ".."], mout, merr,
             exitfun=myexit)
        cleanup_std_log(mout, merr)
        missing_files, additional_files, diffs = compare_results(mdir)
        assert(len(missing_files)==0)
        assert(len(additional_files)==0)
        assert(len(diffs)==0)
        delete_result_is_dir()
示例#7
0
    def test_pos_001(self):
        "BB Basic with one requirement - check makefile dependencies"

        def myexit(n):
            pass

        mout, merr = prepare_result_is_dir()
        main(["-f", mdir + "/input/Config1.py", "-m", "..", "-c",
              os.path.join(os.environ["rmtoo_test_dir"], "makefile_deps")], 
             mout, merr, exitfun=myexit)
        cleanup_std_log(mout, merr)
        unify_output_dir("makefile_deps")
        missing_files, additional_files, diffs = compare_results(mdir)
        assert(len(missing_files)==0)
        assert(len(additional_files)==0)
        assert(len(diffs)==0)
        delete_result_is_dir()
示例#8
0
    def test_pos_001(self):
        "Pulp Fiction's Mr Wulf in English with Solved by"

        def myexit(n):
            pass

        mout, merr = prepare_result_is_dir()
        main(["-f", mdir + "/input/Config2.py", "-m", ".."], mout, merr,
             exitfun=myexit)
        cleanup_std_log(mout, merr)
        missing_files, additional_files, diffs = compare_results(mdir)
        assert(len(missing_files)==0)
        assert(len(additional_files)==0)

        if len(diffs)!=0:
            print("DIFFS '%s'" % diffs)

        assert(len(diffs)==0)
        delete_result_is_dir()
示例#9
0
    def test_pos_001(self):
        "BB Hotspot in the middle of the graph 2"

        def myexit(n):
            pass

        mout, merr = prepare_result_is_dir()
        main(["-f", mdir + "/input/Config2.py", "-m", ".."], mout, merr,
             exitfun=myexit)
        cleanup_std_log(mout, merr)
        missing_files, additional_files, diffs = compare_results(mdir)
        assert(len(missing_files)==0)
        assert(len(additional_files)==0)

        if len(diffs)!=0:
            print("DIFFS '%s'" % diffs)

        assert(len(diffs)==0)
        delete_result_is_dir()
示例#10
0
    def test_pos_001(self):
        "BB Basic with one requirement - reqs only from git"

        def myexit(n):
            pass

        mout, merr = prepare_result_is_dir()
        main(["-f", mdir + "/input/Config1.py", "-m", ".."], mout, merr,
             exitfun=myexit)
        cleanup_std_log(mout, merr)
        extract_container_files(["reqspricing.ods",])
        missing_files, additional_files, diffs = compare_results(mdir)
        assert(len(missing_files)==0)
        assert(len(additional_files)==0)

        if len(diffs)!=0:
            print("DIFFS '%s'" % diffs)

        assert(len(diffs)==0)
        delete_result_is_dir()
示例#11
0
    def test_pos_001(self):
        "BB Basic with some requirements - used for the slides"

        def myexit(n):
            pass

        mout, merr = prepare_result_is_dir()
        main(["-f", mdir + "/input/Config1.py", "-m", ".."], mout, merr,
             exitfun=myexit)
        cleanup_std_log(mout, merr)
        extract_container_files(["reqspricing.ods",])
        missing_files, additional_files, diffs = compare_results(mdir)

        assert(len(missing_files)==0)
        assert(len(additional_files)==0)

        # There must be a diff - because the estimated end date 
        # is also based on the date of today
        if len(diffs)!=2:
            print("DIFFS '%s'" % diffs)

        assert(len(diffs)==2)
示例#12
0
    def rmttest_pos_002(self):
        "BB Basic with one requirement - reqs only from FILES"

        def myexit(n):
            pass

        os.environ["basedir"] = mdir
        mout, merr = prepare_result_is_dir()
        main_impl(["-j", "file://" + mdir + "/input/Config.json"],
                  mout,
                  merr,
                  exitfun=myexit)
        cleanup_std_log(mout, merr)
        #        extract_container_files(["reqspricing.ods", ])
        missing_files, additional_files, diffs = compare_results(mdir)
        self.assertEqual(0, len(missing_files))
        if len(additional_files) != 0:
            print("ADDITIONAL FILES [%s]" % additional_files)
        self.assertEqual(0, len(additional_files))
        # The count stats is always different because of the timestamp

        if len(diffs) != 1:
            print("DIFFS '%s'" % diffs)

        self.assertEqual(1, len(diffs))
        # Diffs are the from the stats count file:
        # ['---  \n',
        #  '+++  \n',
        #  '@@ -1,1 +1,5 @@\n',
        #  '-2010-07-31_06:11:27 1\n', -- or similar
        #  '+2010-07-30_21:04:35 1\n',
        #  '+2010-07-30_21:03:22 1\n',
        #  '+2010-07-30_20:57:36 1\n',
        #  '+2010-07-29_21:17:15 1\n',
        #  '+2010-07-29_21:09:03 1\n']
        self.assertEqual(9, len(diffs["stats_reqs_cnt.csv"]))
        delete_result_is_dir()