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
Make pytest plugin resiliant to missing bindings #4851
Conversation
9c3b363
to
3582493
Compare
_api_client_set.remove(pulpcore_client) | ||
|
||
|
||
# TODO Deprecate all the api_client fixtures below. |
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.
I hope, we can get a lot of boilerplate out of the way here.
26f39ee
to
cb993ee
Compare
This also provides new pulpcore_bindings and file_bindings fixtures that will provide all the bindings apis preconfigured. fixes pulp#4851
cb993ee
to
0ae5229
Compare
This also provides new pulpcore_bindings and file_bindings fixtures that will provide all the bindings apis preconfigured. fixes pulp#4851
0ae5229
to
08f17dc
Compare
This also provides new pulpcore_bindings and file_bindings fixtures that will provide all the bindings apis preconfigured. fixes pulp#4851
d0a5ef5
to
80c8d8d
Compare
""" | ||
A namespace providing preconfigured pulpcore api clients. | ||
|
||
e.g. `pulpcore_bindings.WorkersApi.list()`. |
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.
This will also bring us away from the questionable practice of giving these apis new names. (I mean the generated names are not always great, but they are there to be anyway.)
|
||
gpg = gnupg.GPG(gnupghome=signing_gpg_homedir_path) | ||
|
||
gpg.import_keys(private_key_data) | ||
gpg.import_keys(response.content) |
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.
👍
e127d70
to
c967512
Compare
c050737
to
f6eeadc
Compare
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.
I like the new approach.
def _proxy_module(): | ||
import proxy | ||
|
||
return proxy |
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.
Should this be a session fixture?
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.
Oh absolutely.
""" | ||
Wait for a task to reach a final state. | ||
|
||
Returns the task in "completed" state, or throws a `PulpTaskTimeoutError` in case the timeout | ||
in seconds (defaulting to 30*60) exceeded or a `PulpTaskError` in case it reached any other | ||
final state. | ||
""" | ||
from pulpcore.client.pulpcore import ApiException |
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.
If the bindings are in pulpcore_bindings
then I don't think we need this import.
|
||
def __getattr__(self, name): | ||
# __getattr__ is only consulted if nothing is found in __dict__. | ||
assert name.endswith("Api") |
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 only problem with this assert is that the API classes can have custom names if the view is using drf_spectacular.
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.
Do you have an example?
I can remove it...
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.
@gerrod3 I have yet to see one example...
8820a61
to
67c44e2
Compare
67c44e2
to
70e419c
Compare
This also provides new pulpcore_bindings and file_bindings fixtures that will provide all the bindings apis preconfigured. fixes pulp#4751
70e419c
to
54dcd7a
Compare
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.
This looks good to me. I like how it simplifies things while adding the lazy loading support.
This should eventually make the pytest plugins more lightweight until actually used, and prevent import errors, when bindings that are not supposed to be used are not installed.