本文整理汇总了Python中tests.functional_tests.run_tuttle_file函数的典型用法代码示例。如果您正苦于以下问题:Python run_tuttle_file函数的具体用法?Python run_tuttle_file怎么用?Python run_tuttle_file使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了run_tuttle_file函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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
示例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
示例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
示例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
示例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)
示例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
示例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')
示例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
示例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
示例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
示例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
示例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
示例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
示例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
示例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