Exemple #1
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()
Exemple #2
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()
Exemple #3
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()
Exemple #4
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()
Exemple #5
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()
Exemple #6
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()
Exemple #7
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()
Exemple #8
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()
Exemple #9
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()
Exemple #10
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()
Exemple #11
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()
Exemple #12
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()
Exemple #13
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()
Exemple #14
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()
Exemple #15
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()
Exemple #16
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()
Exemple #17
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()
Exemple #18
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()
Exemple #19
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()
Exemple #20
0
    def test_positive_02(self):
        "main: check if result is correctly handled: False"
        global myexit_called
        myexit_called=False
        global myexit_val
        myexit_val=None

        def myexit(n):
            global myexit_called
            myexit_called=True
            global myexit_val
            myexit_val=n

        def mymain(args, mstdout, mstderr):
            return False

        main(None, None, None, mymain, myexit)
        assert(myexit_called==True)
        assert(myexit_val==1)
Exemple #21
0
    def test_neg_01(self):
        "main: check if result is correctly handled: Exception"
        global myexit_called
        myexit_called=False
        global myexit_val
        myexit_val=None

        def myexit(n):
            global myexit_called
            myexit_called=True
            global myexit_val
            myexit_val=n

        def mymain(args, mstdout, mstderr):
            raise RMTException(63, "test thingy")

        main(None, None, sys.stderr, mymain, myexit)
        assert(myexit_called==True)
        assert(myexit_val==1)
Exemple #22
0
    def test_neg_01(self):
        "main: check if result is correctly handled: Exception"
        global myexit_called
        myexit_called = False
        global myexit_val
        myexit_val = None

        def myexit(n):
            global myexit_called
            myexit_called = True
            global myexit_val
            myexit_val = n

        def mymain(args, mstdout, mstderr):
            raise RMTException(63, "test thingy")

        main(None, None, sys.stderr, mymain, myexit)
        assert (myexit_called == True)
        assert (myexit_val == 1)
Exemple #23
0
    def test_positive_02(self):
        "main: check if result is correctly handled: False"
        global myexit_called
        myexit_called = False
        global myexit_val
        myexit_val = None

        def myexit(n):
            global myexit_called
            myexit_called = True
            global myexit_val
            myexit_val = n

        def mymain(args, mstdout, mstderr):
            return False

        main(None, None, None, mymain, myexit)
        assert (myexit_called == True)
        assert (myexit_val == 1)
Exemple #24
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()
Exemple #25
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()
Exemple #26
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()
Exemple #27
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)
Exemple #28
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()
Exemple #29
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()