forked from osl-incubator/makim
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Fix IF statement and arguments used by dependencies (osl-incubat…
…or#24) * fix: Fix IF statement and arguments used by dependencies * Add unittests
- Loading branch information
Showing
5 changed files
with
127 additions
and
44 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,55 @@ | ||
version: 1.0.0 | ||
env-file: .env | ||
groups: | ||
- name: tests | ||
targets: | ||
test-1: | ||
help: test-1 args `all` should be false | ||
args: | ||
all: | ||
type: bool | ||
action: store_true | ||
help: arg `all` | ||
run: | | ||
assert not {{ args.all }} | ||
test-2: | ||
help: test-2 args `all` should be true | ||
args: | ||
all: | ||
type: bool | ||
action: store_true | ||
help: arg `all` | ||
run: | | ||
assert {{ args.all }} | ||
test-3-a: | ||
help: test-3-a is a dep for test-3-b | ||
run: "true" | ||
|
||
test-3-b: | ||
help: test-3-b | ||
dependencies: | ||
- target: test-3-a | ||
run: "true" | ||
|
||
test-4-dep: | ||
help: test-4-dep is a dep for test-4 | ||
args: | ||
arg1: | ||
help: arg1 | ||
type: bool | ||
action: store_true | ||
run: | | ||
assert {{ args.arg1 }} | ||
test-4: | ||
help: test-4 | ||
args: | ||
trigger-dep: | ||
type: bool | ||
action: store_true | ||
dependencies: | ||
- target: test-3-a | ||
if: {{ args.trigger_dep }} | ||
run: "true" |
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 |
---|---|---|
@@ -1,16 +1,29 @@ | ||
"""Tests for `makim` package.""" | ||
from pathlib import Path | ||
|
||
import pytest | ||
|
||
import makim # noqa: F401 | ||
import makim | ||
|
||
|
||
@pytest.fixture | ||
def response(): | ||
"""Sample pytest fixture. | ||
@pytest.mark.parametrize( | ||
'args', | ||
[ | ||
{'target': 'tests.test-1'}, | ||
{'target': 'tests.test-1', '--all': False}, | ||
{'target': 'tests.test-2', '--all': True}, | ||
{'target': 'tests.test-3-a'}, | ||
{'target': 'tests.test-3-b'}, | ||
{'target': 'tests.test-4'}, | ||
{'target': 'tests.test-4', '--trigger-dep': True}, | ||
], | ||
) | ||
def test_success(args): | ||
makim_file = Path(__file__).parent / '.makim-unittest.yaml' | ||
|
||
See more at: http://doc.pytest.org/en/latest/fixture.html | ||
""" | ||
m = makim.Makim() | ||
m.load(makim_file) | ||
|
||
args.update({'makim_file': makim_file}) | ||
|
||
def test_content(response): | ||
"""Sample pytest test function with the pytest fixture as an argument.""" | ||
m.run(args) |