• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python functional_tests.run_tuttle_file函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中tests.functional_tests.run_tuttle_file函数的典型用法代码示例。如果您正苦于以下问题:Python run_tuttle_file函数的具体用法?Python run_tuttle_file怎么用?Python run_tuttle_file使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了run_tuttle_file函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_keep_going_after_error_no_more_process_to_run

    def test_keep_going_after_error_no_more_process_to_run(self):
        """ If a workflow fail, running it again with option keep_going, should not run another process if
            there nothing to run
            """

        project = """file://B <- file://A
    echo A produces B > B
    echo about to fail
    error

file://C <- file://A
    sleep 1
    echo A produces C > C
    echo A have produced C

file://D <- file://B
    echo B produces D > D
    echo B have produced D
"""
        rcode1, output1 = run_tuttle_file(project, nb_workers=2)
        assert rcode1 == 2, output1

        rcode, output = run_tuttle_file(project, nb_workers=2, keep_going=True)
        assert rcode == 2, output1 + "\n" + output
        assert output.find("* file://B") == -1, output

        assert output.find("Nothing to do") >= 0, output
开发者ID:lexman,项目名称:tuttle,代码行数:27,代码来源:test_keep_going.py


示例2: test_change_a_resource

    def test_change_a_resource(self):
        """ If a resource (not primary) has changed outside tuttle, it should be invalidated if checking integrity"""
        first = """file://C file://B <- file://A
    echo A produces B
    echo A produces B > B
    echo A produces C
    echo A produces C > C

file://D <- file://C   
    echo C produces D
    echo C produces D > D
"""
        rcode, output = run_tuttle_file(first)
        assert rcode == 0, output
        assert path.exists('B')
        assert path.exists('C')
        with open('B', 'w') as f:
            f.write('B has changed')

        rcode, output = run_tuttle_file(first, check_integrity=True)
        assert rcode == 0
        assert output.find("file://B") >= 0, output
        assert output.find("file://C") >= 0, output
        assert output.find("file://D") >= 0, output
        assert output.find("A produces B") >= 0, output
        assert output.find("A produces C") >= 0, output
        assert output.find("C produces D") >= 0, output
开发者ID:lexman,项目名称:tuttle,代码行数:27,代码来源:test_invalidate_resource.py


示例3: test_remove_primary

    def test_remove_primary(self):
        """ Remove the first process and transform a resource in a primary resource should be
        considered as processing """
        first = """file://B <- file://A
            echo A produces another B
            echo A produces B > B

file://C <- file://B
            echo B produces C
            echo B produces C > C
"""
        rcode, output = run_tuttle_file(first)
        assert rcode == 0, output

        second = """file://C <- file://B
            echo B produces C
            echo B produces C > C
"""
        rcode, output = run_tuttle_file(second)
        assert rcode == 0, output
        assert output.find("Report has been updated") >= 0, output
        report = open(join('.tuttle', 'report.html')).read()
        assert report.find('file://A') == -1, report
        dump = open(join('.tuttle', 'last_workflow.pickle')).read()
        assert report.find('file://A') == -1, report
开发者ID:PointyShinyBurning,项目名称:tuttle,代码行数:25,代码来源:test_invalidate_resource.py


示例4: test_should_run_after_invalidation

    def test_should_run_after_invalidation(self):
        """  """
        project = """file://B <- file://A
            echo A produces B
            echo A produces B > B

file://C <- file://B
            echo B produces C
            echo B produces C > C
"""
        rcode, output = run_tuttle_file(project)
        assert rcode == 0, output

        project = """file://B <- file://A
            echo A produces another B
            echo A produces B > B

file://C <- file://B
            echo B produces C
            echo B produces C > C
"""
        rcode, output = run_tuttle_file(project)
        assert rcode == 0, output
        assert output.find("file://B") >= 0, output
        assert output.find("file://C") >= 0, output
        assert output.find("A produces another B") >= 0, output
        assert output.find("B produces C") >= 0, output
开发者ID:PointyShinyBurning,项目名称:tuttle,代码行数:27,代码来源:test_invalidate_resource.py


示例5: test_processes_paths

    def test_processes_paths(self):
        """ After a process has run, former logs and reserved_path should have moved according to
            the new name of the process
        """
        project = """file://B <- file://A
        echo A produces B > B
        echo A has produced B
"""
        rcode, output = run_tuttle_file(project)
        assert rcode == 0, output

        out_log = open(TuttleDirectories.tuttle_dir("processes", "logs", "tuttlefile_1_stdout.txt")).read()
        assert out_log.find("A has produced B") > -1, out_log

        assert exists(TuttleDirectories.tuttle_dir("processes", "tuttlefile_1"))
        # out_log = open(TuttleDirectories.tuttle_dir("processes", "tuttlefile_1")).read()
        # assert out_log.find("echo A has produced B") > -1, out_log

        project = """file://C <- file://A ! python
    f = open('C', 'w')
    f.write('A produces C')
    print('echo A has produced C')

file://B <- file://A
        echo A produces B > B
        echo A has produced B
"""
        rcode, output = run_tuttle_file(project)
        assert rcode == 0, output

        out_log = open(TuttleDirectories.tuttle_dir("processes", "logs", "tuttlefile_6_stdout.txt")).read()
        assert out_log.find("A has produced B") > -1, out_log

        reserved_path = TuttleDirectories.tuttle_dir("processes", "tuttlefile_6")
        assert exists(reserved_path)
开发者ID:lexman,项目名称:tuttle,代码行数:35,代码来源:test_standard_behaviour.py


示例6: test_abort_if_lost_exceeds_threshold

    def test_abort_if_lost_exceeds_threshold(self):
        """ Should disply a message and abort if processing time lost by invalidation is above the threshold """
        first = """file://B <- file://A
    echo A produces B
    echo B > B

file://C <- file://B
    echo B produces C
    python -c "import time; time.sleep(2)"
    echo C > C
"""
        rcode, output = run_tuttle_file(first)
        assert rcode == 0, output
        assert isfile('C')
        second = """file://B <- file://A
    echo B has changed
    echo B has changed > B

file://C <- file://B
    echo B produces C
    python -c "import time; time.sleep(2)"
    echo C > C
"""
        rcode, output = run_tuttle_file(second, threshold=1)
        assert rcode == 2, output
        assert output.find("Aborting") >= 0, output
开发者ID:PointyShinyBurning,项目名称:tuttle,代码行数:26,代码来源:test_threshold.py


示例7: test_not_abort_if_threshold_is_0

    def test_not_abort_if_threshold_is_0(self):
        """ Should abort if threshold whatever lost time is"""
        first = """file://B <- file://A
    echo A produces B
    echo B > B

file://C <- file://B
    echo B produces C
    echo C > C
"""
        rcode, output = run_tuttle_file(first)
        assert rcode == 0, output
        assert isfile('B')
        assert isfile('C')

        second = """file://B <- file://A
    echo B has changed
    echo B has changed > B

file://C <- file://B
    echo B produces C
    echo C > C
"""
        rcode, output = run_tuttle_file(second, threshold=0)
        assert rcode == 2, output
        assert output.find("Aborting") >= 0, output
        assert isfile('B')
        assert isfile('C')
开发者ID:PointyShinyBurning,项目名称:tuttle,代码行数:28,代码来源:test_threshold.py


示例8: test_remove_resource

    def test_remove_resource(self):
        """If a resource is removed from a tuttlefile, it should be invalidated"""
        first = """file://B <- file://A
    echo A produces B
    echo B > B

file://C <- file://B
    echo B produces C
    echo C > C

file://D <- file://A
    echo A produces D
    echo D > D
"""
        rcode, output = run_tuttle_file(first)
        assert path.exists('B')
        assert path.exists('C')
        assert path.exists('D')
        second = """file://C <- file://A
    echo A produces C
    echo C > C

file://D <- file://A
    echo A produces D
    echo D > D
"""
        rcode, output = run_tuttle_file(second)
        assert rcode == 0
        assert output.find("* file://B") >= 0, output
        assert output.find("* file://C") >= 0, output
        assert output.find("* file://D") == -1, output
开发者ID:PointyShinyBurning,项目名称:tuttle,代码行数:31,代码来源:test_invalidate_resource.py


示例9: test_rerun_outputless_process_if_code_changed

    def test_rerun_outputless_process_if_code_changed(self):
        """ An outputless process should not re-run if it hasn't changed """
        first = """ <- file://A
            echo Action after A is created
"""
        rcode, output = run_tuttle_file(first)
        assert rcode == 0, output

        rcode, output = run_tuttle_file(first)
        assert rcode == 0
        assert output.find("Nothing to do") >= 0, output
开发者ID:lexman,项目名称:tuttle,代码行数:11,代码来源:test_invalidate_resource.py


示例10: test_keep_going_after_error_open

    def test_keep_going_after_error_open(self):
        """ If a workflow fail, running it again with option keep_going,
            it should run all it can"""

        # The ordder matters
        project = """
file://B <- file://A
    echo A produces B > B
    echo A have produced B

file://C <- file://A
    echo A won't produce C
    echo A won't produce C > C
    echo about to fail
    error

file://D <- file://A
    echo A produces D > D
    echo A have produced D

file://E <- file://A
    echo A produces E > E
    echo A have produced E
    
file://F <- file://A
    echo A produces F > F
    echo A have produced F
    
file://G <- file://A
    echo A produces G > G
    echo A have produced G
    
file://H <- file://A
    echo A produces H > H
    echo A have produced H
    
"""
        rcode1, output1 = run_tuttle_file(project, nb_workers=1)
        assert rcode1 == 2, output1
        # Hope that tuttle has not run this process
        nb_splits = len(output1.split("A have produced"))
        # We can't control the order in which tuttle run the processes
        # but we can control the order is ok to test
        if nb_splits >= 7:
            raise SkipTest("Damned ! The tests won't be accurate because tuttle choose to run the "
                           "failing process last \n" + str(nb_splits) + "\n" + output1)

        rcode, output = run_tuttle_file(project, nb_workers=1, keep_going=True)
        assert rcode == 2, output1 + "\n" + output
        assert output.find("* file://C") == -1, output

        assert output.find("A have produced") >= 0, output
开发者ID:lexman,项目名称:tuttle,代码行数:52,代码来源:test_keep_going.py


示例11: test_should_tell_if_already_ok

    def test_should_tell_if_already_ok(self):
        """ If nothing has to run, the user should be informed every thing is ok
        """
        project = """file://B <- file://A
        echo A produces B > B
        echo A produces B
"""
        rcode, output = run_tuttle_file(project)
        assert rcode == 0, output
        assert output.find("A produces B") >= 0, output
        rcode, output = run_tuttle_file(project)
        assert rcode == 0, output
        assert output.find("Nothing to do") >= 0, output
开发者ID:lexman,项目名称:tuttle,代码行数:13,代码来源:test_standard_behaviour.py


示例12: test_code_changes

 def test_code_changes(self):
     """ A resource should be invalidated if the code that creates it changes"""
     project1 = """file://B <- file://A
     echo A creates B > B
     """
     rcode, output = run_tuttle_file(project1)
     assert isfile('B')
     project2 = """file://B <- file://A
     echo A creates B in another way> B
     """
     rcode, output = run_tuttle_file(project2)
     assert rcode == 0
     assert output.find("* file://B") >= 0, output
     assert output.find(PROCESS_HAS_CHANGED) >= 0, output
开发者ID:PointyShinyBurning,项目名称:tuttle,代码行数:14,代码来源:test_invalidate_resource.py


示例13: test_no_error_with_download_process

    def test_no_error_with_download_process(self):
        """ Download process does not create code in reserved_path for the process... Thus it cant be moved when """
        """ retreiving logs and reserved path from previous execution(from bug) """
        project = """file://g <-  http://localhost:8043/a_resource ! download

file://h <- file://g
    ERROR
        """
        rcode, output = run_tuttle_file(project)
        assert rcode == 2, output
        rcode, output = tuttle_invalidate()
        assert rcode == 0, output
        rcode, output = run_tuttle_file()
        assert rcode == 2, output
开发者ID:lexman,项目名称:tuttle,代码行数:14,代码来源:test_net_addon.py


示例14: test_dont_invalidate_if_errors

    def test_dont_invalidate_if_errors(self):
        """ A change in a process without output should re-run the process (from bug) """
        first = """ <- file://A
            echo Action after A is created
"""
        rcode, output = run_tuttle_file(first)
        assert rcode == 0, output

        second = """ <- file://A
            echo Another action after A is created
"""
        rcode, output = run_tuttle_file(second)
        assert rcode == 0
        assert output.find("Another") >= 0, output
开发者ID:PointyShinyBurning,项目名称:tuttle,代码行数:14,代码来源:test_invalidate_resource.py


示例15: test_modified_primary_resource_should_invalidate_dependencies

    def test_modified_primary_resource_should_invalidate_dependencies(self):
        """ If a primary resource is modified, it should invalidate dependencies"""
        project = """file://B <- file://A
    echo A produces B
    echo B > B
"""
        rcode, output = run_tuttle_file(project)
        assert rcode == 0, output
        with open('A', 'w') as f:
            f.write('A has changed')
        rcode, output = run_tuttle_file(project)
        assert rcode == 0, output
        assert output.find('* file://A') == -1, output
        assert output.find('* file://B') >= 0, output
        assert output.find('A produces B') >= 0, output
开发者ID:PointyShinyBurning,项目名称:tuttle,代码行数:15,代码来源:test_invalidate_resource.py


示例16: test_pre_check_before_invalidation

    def test_pre_check_before_invalidation(self):
        """Pre check should happen before invalidation"""
        project1 = """file://A <-
        echo A > A
        """
        rcode, output = run_tuttle_file(project1)
        assert isfile('A')
        project2 = """file://A <-
        echo different > A
file://google.html <- file://A ! download
        """
        rcode, output = run_tuttle_file(project2)
        assert rcode == 2
        assert output.find("* file://B") == -1
        assert output.find("Download processor") >= 0, output
开发者ID:PointyShinyBurning,项目名称:tuttle,代码行数:15,代码来源:test_net_extension.py


示例17: test_relative_resource_is_attached_to_tuttlefile

 def test_relative_resource_is_attached_to_tuttlefile(self):
     """If you move a whole project, it must still work"""
     project = """file://B <- file://A
     echo A produces B >B
     echo A produces B
     """""
     run_tuttle_file(project)
     assert isfile('B')
     tmp_dir = mkdtemp()
     copycontent('.', tmp_dir)
     assert isfile(join(tmp_dir, 'B'))
     with CurrentDir(tmp_dir):
         invalidate(join(tmp_dir, 'tuttlefile'), ['file://B'])
     assert isfile('B'), "File B in the origin project should still exist"
     assert not isfile(join(tmp_dir, 'B')), "File B in the copied project should have been removed"
开发者ID:lexman,项目名称:tuttle,代码行数:15,代码来源:test_file_resource.py


示例18: test_resource_dependency_change

    def test_resource_dependency_change(self):
        """ A resource should be invalidated if it does not depend on the same resource anymore
        """
        project1 = """file://C <- file://A, file://B  
    echo A creates C > C
"""
        rcode, output = run_tuttle_file(project1)
        assert isfile('B')
        project2 = """file://C <- file://A
    echo A creates C > C
"""
        rcode, output = run_tuttle_file(project2)
        assert rcode == 0
        assert output.find("* file://C") >= 0, output
        assert output.find(NOT_SAME_INPUTS) >= 0, output
开发者ID:PointyShinyBurning,项目名称:tuttle,代码行数:15,代码来源:test_invalidate_resource.py


示例19: test_keep_going

    def test_keep_going(self):
        """  If tuttle is run with option keep_going, it should run all it can and not stop at first error"""
        # As in Gnu Make

        project = """file://B <- file://A
    Obvious error

file://C <- file://B
    echo B produces C > C

file://D <- file://A
    echo A produces D
    echo A produces D > D

file://E <- file://A
    Another error
"""
        rcode, output = run_tuttle_file(project, nb_workers=1, keep_going=True)
        assert rcode == 2
        assert output.find("::stderr") >= 0, output
        assert output.find("Obvious") >= 0, output
        assert output.find("Another") >= 0, output
        assert output.find("Process ended with error code 1") >= 0, output
        pos_have_failed = output.find("have failed")
        assert pos_have_failed >= 0, output
        assert output.find("tuttlefile_1", pos_have_failed) >= 0, output
        assert output.find("tuttlefile_11", pos_have_failed) >= 0, output
开发者ID:PointyShinyBurning,项目名称:tuttle,代码行数:27,代码来源:test_keep_going.py


示例20: test_threshold_in_command_line_run

    def test_threshold_in_command_line_run(self):
        """ The threshold -t parameter should be available from the command line"""
        first = """file://B <- file://A
    echo A produces B
    python -c "import time; time.sleep(1)"
    echo B > B

file://C <- file://B
    echo B produces C
    echo C > C
"""
        rcode, output = run_tuttle_file(first)
        assert rcode == 0, output
        assert isfile('B')

        second = """file://B <- file://A
    echo B has changed
    echo B has changed > B
"""
        with open('tuttlefile', "w") as f:
            f.write(second)
        proc = Popen(['tuttle', 'run', '-t', '1'], stdout=PIPE)
        output = proc.stdout.read()
        rcode = proc.wait()
        assert rcode == 2, output

        assert output.find('Aborting') >= 0, output
        assert isfile('B'), output
开发者ID:PointyShinyBurning,项目名称:tuttle,代码行数:28,代码来源:test_threshold.py



注:本文中的tests.functional_tests.run_tuttle_file函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python gbe_functions.assert_alert_exists函数代码示例发布时间:2022-05-27
下一篇:
Python utils.get_global函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap