-
Notifications
You must be signed in to change notification settings - Fork 18
Make Container, DerivedContainer & Pod inherit from ParameterSet #216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #216 +/- ##
==========================================
+ Coverage 96.36% 96.77% +0.40%
==========================================
Files 9 9
Lines 1101 1178 +77
Branches 164 168 +4
==========================================
+ Hits 1061 1140 +79
+ Misses 25 23 -2
Partials 15 15 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
5c3f7e4 to
bdb8375
Compare
1031d79 to
9404424
Compare
89b9016 to
93bb2e4
Compare
1c0230f to
de27761
Compare
de27761 to
a8a7828
Compare
| 1. you are now handling ``pytest.ParameterSet`` instance and have to unpack them | ||
| to access the underlying :py:class:`~pytest_container.container.Container` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are now handling (...) instance, and have to unpack them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the issue is this: let's say you are creating a TW container image:
TW = Container(url="registry.opensuse.org/opensuse/tumbleweed")and now you want to wrap it in a pytest.param(), then you'd usually do this:
TW = pytest.param(
Container(url="registry.opensuse.org/opensuse/tumbleweed"),
marks=[pytest.mark.tumbleweed],
)But now the TW object is no longer an instance of the Container class. If you now want to get any attribute, you have to call:
TW.values[0].urlThe whole point of this gynormous PR is, that Container is a ParameterSet itself, and you directly get TW.url, but it behaves like a ParameterSet as well
source/usage.rst
Outdated
| 2. :py:class:`~pytest_container.container.DerivedContainer` do not "inherit" the | ||
| marks from their base containers. This has proven to be a very annoying | ||
| limitation in practice. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 2. :py:class:`~pytest_container.container.DerivedContainer` do not "inherit" the | |
| marks from their base containers. This has proven to be a very annoying | |
| limitation in practice. | |
| 2. :py:class:`~pytest_container.container.DerivedContainer` does not "inherit" the | |
| marks from their base containers. This has proven to be a very annoying | |
| limitation in practice. |
"inherit"
Why is inherit in double quotes?
This has proven to be a very annoying limitation in practice.
Either explain why it's a limitation (without using subjective "Annoying"), or drop it altogether.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"inherit"
Why inherit is in double quotes?
Because it is not classical class based inheritance as used in programming.
This has proven to be a very annoying limitation in practice.
Either explain why it's a limitation (without using subjective "Annoying"), or drop it altogether.
This is a rather specific BCI-Tests problem that we saw in practice. We often have a base image, e.g. bci/golang. And now we have multiple test with their own Container Images classes (e.g. due to different dockerfiles). But since the marks don't "carry over" or "inherit" we have to do this:
golang = pytest.param(Container(…args…), marks=pytest.mark.golang)
param1 = pytest.param(DerivedContainer(base=golang.param[0], containerfile="something"), marks=golang.marks)
param2= pytest.param(DerivedContainer(base=golang.param[0], containerfile="something else"), marks=golang.marks)
# and so onwith this PR, we can now just write:
golang = Container(…args…, marks=pytest.mark.golang)
param1 = DerivedContainer(base=golang, containerfile="something")
param2= DerivedContainer(base=golang, containerfile="something else")
# and so onand the result is the same
5e713b1 to
282787c
Compare
9b1160a to
fc1bc6b
Compare
Co-authored-by: Dmitri Popov <[email protected]>
We can't do anything about the number of instance attributes, because they are mandated by the output of `podman container inspect`
pathlib.Path is automatically resolved to the local implementation by sphinx autodoc, which then cannot be found by intersphinx.
It just takes time for no benefit
No description provided.