-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
125 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import os, re, subprocess, pytest | ||
from .test_recipe import change_test_dir, run, verify_output | ||
|
||
def test_conditional_skips(): | ||
os.system("rm -fr test_conditional_skips[1234].tmp") | ||
print("===== all three files touched =====") | ||
retcode, output = run("stimela -b native run test_conditional_skips.yml") | ||
assert retcode == 0 | ||
print(output) | ||
assert verify_output(output, "running touch test_conditional_skips1.tmp") | ||
assert verify_output(output, "running touch test_conditional_skips2.tmp") | ||
assert verify_output(output, "running touch test_conditional_skips3.tmp") | ||
|
||
print("===== 2 and 3 touched =====") | ||
os.system("touch test_conditional_skips4.tmp") | ||
retcode, output = run("stimela -b native run test_conditional_skips.yml") | ||
assert retcode == 0 | ||
print(output) | ||
assert not verify_output(output, "running touch test_conditional_skips1.tmp") | ||
assert verify_output(output, "running touch test_conditional_skips2.tmp") | ||
assert verify_output(output, "running touch test_conditional_skips3.tmp") | ||
|
||
print("===== only 3 touched =====") | ||
retcode, output = run("stimela -b native run test_conditional_skips.yml") | ||
assert retcode == 0 | ||
print(output) | ||
assert not verify_output(output, "running touch test_conditional_skips1.tmp") | ||
assert not verify_output(output, "running touch test_conditional_skips2.tmp") | ||
assert verify_output(output, "running touch test_conditional_skips3.tmp") | ||
|
||
print("===== 2 and 3 touched =====") | ||
retcode, output = run("stimela -b native run test_conditional_skips.yml -f") | ||
assert retcode == 0 | ||
print(output) | ||
assert not verify_output(output, "running touch test_conditional_skips1.tmp") | ||
assert verify_output(output, "running touch test_conditional_skips2.tmp") | ||
assert verify_output(output, "running touch test_conditional_skips3.tmp") | ||
|
||
print("===== 1 and 3 touched =====") | ||
retcode, output = run("stimela -b native run test_conditional_skips.yml -F") | ||
assert retcode == 0 | ||
print(output) | ||
assert verify_output(output, "running touch test_conditional_skips1.tmp") | ||
assert not verify_output(output, "running touch test_conditional_skips2.tmp") | ||
assert verify_output(output, "running touch test_conditional_skips3.tmp") | ||
|
||
print("===== all three files touched =====") | ||
retcode, output = run("stimela -b native run test_conditional_skips.yml -f -F") | ||
assert retcode == 0 | ||
print(output) | ||
assert verify_output(output, "running touch test_conditional_skips1.tmp") | ||
assert verify_output(output, "running touch test_conditional_skips2.tmp") | ||
assert verify_output(output, "running touch test_conditional_skips3.tmp") | ||
|
||
print("===== cleaning up =====") | ||
os.system("rm -fr test_conditional_skips[1234].tmp") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
cabs: | ||
touch: | ||
command: touch | ||
inputs: | ||
conditional-file: | ||
dtype: File | ||
must_exist: false | ||
policies: | ||
skip: true # not passed to command | ||
outputs: | ||
file: | ||
dtype: File | ||
policies: | ||
positional: true | ||
|
||
recipe: | ||
steps: | ||
touch1: | ||
cab: touch | ||
params: | ||
file: test_conditional_skips1.tmp | ||
skip_if_outputs: exist | ||
|
||
touch2: | ||
cab: touch | ||
params: | ||
conditional-file: test_conditional_skips4.tmp | ||
file: test_conditional_skips2.tmp | ||
skip_if_outputs: fresh | ||
|
||
touch3: | ||
cab: touch | ||
params: | ||
file: test_conditional_skips3.tmp |