-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP: add as_pytest_param property to ContainerBaseABC & Pod
- Loading branch information
Showing
4 changed files
with
116 additions
and
0 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,53 @@ | ||
import pytest | ||
from pytest_container.container import Container | ||
from pytest_container.container import DerivedContainer | ||
from pytest_container.pod import Pod | ||
|
||
from tests.images import LEAP_URL | ||
|
||
LEAP_WITH_MARK = Container(url=LEAP_URL, marks=[pytest.mark.secretleapmark]) | ||
|
||
DERIVED_ON_LEAP_WITH_MARK = DerivedContainer(base=LEAP_WITH_MARK) | ||
|
||
SECOND_DERIVED_ON_LEAP = DerivedContainer( | ||
base=DERIVED_ON_LEAP_WITH_MARK, marks=[pytest.mark.othersecretmark] | ||
) | ||
|
||
INDEPENDENT_OTHER_LEAP = Container( | ||
url=LEAP_URL, marks=[pytest.mark.othersecretmark] | ||
) | ||
|
||
UNMARKED_POD = Pod(containers=[LEAP_WITH_MARK, INDEPENDENT_OTHER_LEAP]) | ||
|
||
MARKED_POD = Pod( | ||
containers=[LEAP_WITH_MARK, INDEPENDENT_OTHER_LEAP], | ||
marks=[pytest.mark.secretpodmark], | ||
) | ||
|
||
|
||
def test_marks() -> None: | ||
assert list(LEAP_WITH_MARK.as_pytest_param.marks) == [ | ||
pytest.mark.secretleapmark | ||
] | ||
assert list(DERIVED_ON_LEAP_WITH_MARK.as_pytest_param.marks) == [ | ||
pytest.mark.secretleapmark | ||
] | ||
assert list(SECOND_DERIVED_ON_LEAP.as_pytest_param.marks) == [ | ||
pytest.mark.othersecretmark, | ||
pytest.mark.secretleapmark, | ||
] | ||
|
||
pod_marks = UNMARKED_POD.as_pytest_param.marks | ||
assert ( | ||
len(pod_marks) == 2 | ||
and pytest.mark.othersecretmark in pod_marks | ||
and pytest.mark.secretleapmark in pod_marks | ||
) | ||
|
||
pod_marks = MARKED_POD.as_pytest_param.marks | ||
assert ( | ||
len(pod_marks) == 3 | ||
and pytest.mark.othersecretmark in pod_marks | ||
and pytest.mark.secretleapmark in pod_marks | ||
and pytest.mark.secretpodmark in pod_marks | ||
) |