Пример #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
    def test_pos_01(self):
        "Normalization test"

        def myexit(n):
            self.rval = n

        os.environ["basedir"] = mdir
        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(["-j", "file://" + mdir + "/input/Config.json"], mout, merr,
             main_impl, myexit)
        assert (self.rval == 0)
        cleanup_std_log(mout, merr)
        check_file_results(mdir)
        delete_result_is_dir()
Пример #3
0
    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()
Пример #4
0
    def test_pos(self):
        "BB resulting requirements are not dependend"

        mout, merr = prepare_result_is_dir()
        result = main_impl(["-f", mdir + "/input/Config1.py", "-m", ".."],
                           mout, merr)
        cleanup_std_log(mout, merr)
        check_file_results(mdir)
        delete_result_is_dir()
Пример #5
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)
        check_file_results(mdir)
        delete_result_is_dir()
Пример #6
0
    def test_pos_001(self):
        "BB Basic with one requirement - graph output with defined tags"

        os.environ["basedir"] = mdir
        mout, merr = prepare_result_is_dir()
        result = main_impl(["-j", "file://" + mdir + "/input/Config.json"],
                           mout, merr)
        cleanup_std_log(mout, merr)
        check_file_results(mdir)
        delete_result_is_dir()
Пример #7
0
    def test_pos(self):
        "BB resulting requirements are not dependend"

        os.environ["basedir"] = mdir
        mout, merr = prepare_result_is_dir()
        result = main_impl(["-j", "file://" + mdir + "/input/Config.json"],
                           mout, merr)
        cleanup_std_log(mout, merr)
        check_file_results(mdir)
        delete_result_is_dir()
Пример #8
0
    def test_pos(self):
        "BB Basic where one requirement is not used because not in topic"

        mout, merr = prepare_result_is_dir()
        result = main_impl(["-f", mdir + "/input/Config1.py", "-m", ".."],
                           mout, merr)
        cleanup_std_log(mout, merr)
        assert(result == False)
        check_file_results(mdir)
        delete_result_is_dir()
Пример #9
0
    def test_pos_001(self):
        "BB Basic with one requirement - check log output for typo in topic"

        os.environ["basedir"] = mdir_orig
        os.environ["rbasedir"] = mdir
        mout, merr = prepare_result_is_dir()
        main_impl(["-j", "file://" + mdir + "/input/Config.json"], mout, merr)
        cleanup_std_log(mout, merr)
        check_file_results(mdir)
        delete_result_is_dir()
Пример #10
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)
        assert(result == False)
        check_file_results(mdir)
        delete_result_is_dir()
Пример #11
0
    def test_pos_001(self):
        "BB Basic with one requirement - graph output with defined tags"

        os.environ["basedir"] = mdir
        mout, merr = prepare_result_is_dir()
        result = main_impl(["-j", "file://" + mdir + "/input/Config.json"],
                           mout, merr)
        cleanup_std_log(mout, merr)
        check_file_results(mdir)
        delete_result_is_dir()
Пример #12
0
    def test_pos(self):
        "BB Basic with one requirement - bad analytics"

        os.environ["basedir"] = mdir
        mout, merr = prepare_result_is_dir()
        result = main_impl(["-j", "file://" + mdir + "/input/Config.json"], 
                           mout, merr)
        cleanup_std_log(mout, merr)
        assert(result == False)
        check_file_results(mdir)
        delete_result_is_dir()
Пример #13
0
    def test_pos_001(self):
        "BB Basic with one requirement - check log output for typo in topic"

        os.environ["basedir"] = mdir_orig
        os.environ["rbasedir"] = mdir
        mout, merr = prepare_result_is_dir()
        main_impl(["-j", "file://" + mdir + "/input/Config.json"], 
                  mout, merr)
        cleanup_std_log(mout, merr)
        check_file_results(mdir)
        delete_result_is_dir()
Пример #14
0
    def test_pos(self):
        "BB Basic where one requirement is not used because not in topic"

        os.environ["basedir"] = mdir
        mout, merr = prepare_result_is_dir()
        result = main_impl(["-j", "file://" + mdir + "/input/Config.json"],
                           mout, merr)
        cleanup_std_log(mout, merr)
        assert (result == False)
        check_file_results(mdir)
        delete_result_is_dir()
Пример #15
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)
        check_file_results(mdir)
        delete_result_is_dir()
Пример #16
0
    def test_pos_001(self):
        "Pulp Fiction's Mr Wulf in English"

        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)
        check_file_results(mdir)
        delete_result_is_dir()
Пример #17
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()
Пример #18
0
    def test_PulpFictionInGermanOldConfig(self):
        "Pulp Fiction's Mr Wulf in German (old configuration)."

        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)
        check_file_results(mdir)
        delete_result_is_dir()
Пример #19
0
    def test_pos_001(self):
        "Pulp Fiction's Mr Wulf in English"

        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)
        check_file_results(mdir)
        delete_result_is_dir()
Пример #20
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", ])
        check_file_results(mdir)
        delete_result_is_dir()
Пример #21
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()
Пример #22
0
    def test_PulpFictionInGermanOldConfig(self):
        "Pulp Fiction's Mr Wulf in German (old configuration)."

        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)
        check_file_results(mdir)
        delete_result_is_dir()
Пример #23
0
    def test_pos_001(self):
        "Blackbox test for simple constraint handling"

        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)
        check_file_results(mdir)
        delete_result_is_dir()
Пример #24
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")
        check_file_results(mdir)
        delete_result_is_dir()
Пример #25
0
    def test_pos_001(self):
        "BB Basic with some requirements - used for the slides"

        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)
        extract_container_files(["reqspricing.ods", ])
        cleanup_std_log(mout, merr)
        check_file_results(mdir)
        delete_result_is_dir()
Пример #26
0
    def test_pos_001(self):
        "Blackbox test for simple constraint handling"

        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)
        check_file_results(mdir)
        delete_result_is_dir()
Пример #27
0
    def test_pos_001(self):
        "Pulp Fiction's Mr Wulf in English"

        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)
        check_file_results(mdir)
        delete_result_is_dir()
Пример #28
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()
Пример #29
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()
Пример #30
0
    def test_PulpFictionInGermanOldConfig(self):
        "Pulp Fiction's Mr Wulf in German (old configuration)."

        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)
        check_file_results(mdir)
        delete_result_is_dir()
Пример #31
0
    def test_pos_001(self):
        "BB Basic with one requirement - check makefile dependencies"

        def myexit(n):
            pass

        os.environ["basedir"] = mdir_orig
        os.environ["rbasedir"] = mdir
        mout, merr = prepare_result_is_dir()
        main(["-j", "file://" + mdir + "/input/Config.json",
              "-j", '''json:{"actions": {"create_makefile_dependencies":
                 "${ENV:rmtoo_test_dir}/makefile_deps"}}'''],          
             mout, merr, exitfun=myexit)
        cleanup_std_log(mout, merr)
        unify_output_dir("makefile_deps")
        check_file_results(mdir)
        delete_result_is_dir()
Пример #32
0
    def test_pos_001(self):
        "BB Hotspot in the middle of the graph 2"

        # This is needed, because the prios use localtime
        os.environ['TZ'] = 'Europe/Berlin'
        time.tzset()

        def myexit(n):
            pass

        os.environ["basedir"] = mdir_orig
        os.environ["rbasedir"] = mdir
        mout, merr = prepare_result_is_dir()
        main(["-j", "file://" + mdir + "/input/Config.json"],
             mout, merr, exitfun=myexit)
        cleanup_std_log(mout, merr)
        check_file_results(mdir)
        delete_result_is_dir()
Пример #33
0
    def test_pos_001(self):
        "BB Basic with one requirement - reqs only from git"

        os.environ['TZ'] = 'Europe/Berlin'
        time.tzset()

        def myexit(n):
            pass

        os.environ["basedir"] = mdir_orig
        os.environ["rbasedir"] = 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", ])
        check_file_results(mdir)
        delete_result_is_dir()
Пример #34
0
    def test_pos_001(self):
        "BB Basic with some requirements - used for the slides"

        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)
        extract_container_files([
            "reqspricing.ods",
        ])
        cleanup_std_log(mout, merr)
        check_file_results(mdir)
        delete_result_is_dir()
Пример #35
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()
Пример #36
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()
Пример #37
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()
Пример #38
0
    def test_pos_001(self):
        "BB Hotspot in the middle of the graph 2"

        # This is needed, because the prios use localtime
        os.environ['TZ'] = 'Europe/Berlin'
        time.tzset()

        def myexit(n):
            pass

        os.environ["basedir"] = mdir_orig
        os.environ["rbasedir"] = mdir
        mout, merr = prepare_result_is_dir()
        main(["-j", "file://" + mdir + "/input/Config.json"],
             mout,
             merr,
             exitfun=myexit)
        cleanup_std_log(mout, merr)
        check_file_results(mdir)
        delete_result_is_dir()
Пример #39
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)
Пример #40
0
    def test_pos_001(self):
        "BB Basic with one requirement - reqs only from git"

        os.environ['TZ'] = 'Europe/Berlin'
        time.tzset()

        def myexit(n):
            pass

        os.environ["basedir"] = mdir_orig
        os.environ["rbasedir"] = 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",
        ])
        check_file_results(mdir)
        delete_result_is_dir()
Пример #41
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()