-
Notifications
You must be signed in to change notification settings - Fork 6
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
Reorganize tests #53
Comments
Another aspect I recently noticed is that the |
|
Some additional random thoughts on this subject:
|
Problem 1
In
client_test.py
, the tests override the default__init__
function of each client withnew_init
. Among other things, thisnew_init
overrides the real provider with a fake one which just echoes what it is being sent.The return value of the
post
function of clients is consequently ambiguous:feedspora_runner:197
(suggesting that it should be a boolean as well)client_test.py
, it is tested against adict
This make the implementation of the
post
function unnecessarily complicated and fragile.Problem 2
On top of this convoluted testing strategy, the
post_test
tests also define their own way to test the clients, by passing atesting
parameter to their__init__
. Consequently, some testing-related code has to be implemented in the code being tested, i.e. in the__init__
andpost
function of each client. This is also bad practice, unnecessarily complicated and fragile.Solution
The usual solution to problem 2 is to monkeypatch the objects being tested. However, monkeypatching may cause ambiguous return types like problem 1 unless functions are specifically implemented to be easy and unambiguous to test. Since that's not the case here, this should be fixed.
The text was updated successfully, but these errors were encountered: