-
Notifications
You must be signed in to change notification settings - Fork 2
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
Dm/interface registration test #3051
base: main
Are you sure you want to change the base?
Conversation
Thanks for the detailed writeup @DarkaMaul! The docs changes look good to me, and make a lot of sense to send as an independent PR. In terms of detecting service (non-)registration: I'm not a huge fan of doing this via Instead of trying to do this through introspection, we could perhaps do this through a list of known interfaces + the regular config loading flow. For example: def test_all_interfaces_registered():
# these lists will need to be updated by hand whenever a new interface is added,
# similar to how other config tests get updated whenever Warehouse's config changes
known_interfaces = [IOIDCPublisherService, ...]
ignored_interfaces = [IOriginCache, ...]
# see body of test_configure for the rest of the needed state here
configurator_obj = pretend.stub(register_service_factory=pretend.call_recorder(...))
config.configure(None)
for call in configurator_obj.register_service_factory.calls:
# check all registered interfaces against known_interfaces/ignored_interfaces
... I think that will be much more reliable, at the cost of being slightly more manual (but the config unit tests are already pretty manual, on purpose). Thoughts? |
The PR is open here: #2827
IMO, having the interface list configured manually is less helpful here. |
Ah yeah, I didn't think this through -- the list won't catch the non-registration case. A lint seems possible -- I think it'd be straightforward-ish to write a OTOH, that'll further constrain Warehouse to |
This PR opens some discussions on wherever we want to try to detect if interfaces are registered in the tests.
On the pro side, it would have caught a problem like pypi#16302 .
On the other side:
The current test is failing because
IOriginCache
is not registered.Indeed, the registration is under a flag :
source
This is not a problem because most of the calls to the
find_service
method are called in a try/catch block:source
However, this is not always the case :
purge_key