First pytest migration#1209
Conversation
That test was simply testing each abstract method is defined only once. Reverted to check the number of calls for each abstract method while adding an allowlist, for abstract methods we can call from concrete ones
Also migrate to pytest-style plain asserts
ryneeverett
left a comment
There was a problem hiding this comment.
Regarding the first commit -- oops! Thanks for catching this.
It isn't clear to me that an exception is justified for get_keyring_service though. Perhaps this would be a good time to eliminate the method in favor of a class property string on which Service.get_secret calls .format(config)?
|
I'm ok with removing One solution would be to use a Another solution would be to make |
|
The computed_field solution seems good. Making this a string rather than a method is the main thing I'd like to see. I'd be ok with that string moving to ServiceConfig, but I wouldn't want to see the |
First commit
Fix a test in
test_service.py: since this commit the test check each abstract method is defined only once, which does not really make sense. I changed it back to check the number of calls, while adding an allowlist for some abstract methods we do want to call from concrete methods.An alternative could be to simply remove this test, since we already have an exception
Second commit
Migrate two test classes to pytest (remove
TestCaseinheritance + plain asserts), to ensure we agree on the migration.Note that the changes in
test_dbare not that straightforward becausemerge_leftmutates its first arg andreplace_leftmutates both, which is error-prone IMO. Returning a whole new dict (without modifying inputs) would be safer