Refactor test_recwarn into functional tests instead of testing private implementation#2298
Refactor test_recwarn into functional tests instead of testing private implementation#2298nicoddemus wants to merge 1 commit intopytest-dev:featuresfrom
Conversation
| ret = pytest.deprecated_call(self.dep, 0) | ||
| assert ret == 42 | ||
|
|
||
| def test_deprecated_call_preserves(self): |
There was a problem hiding this comment.
The test is about testing the internal implementation, so I removed it.
| assert len(record) == 1 | ||
| assert str(record[0].message) == "user" | ||
|
|
||
| print(repr(record[0])) |
There was a problem hiding this comment.
This was tested the recent change of the WarningMessage object to a namedtuple, but this is not part of the API and has never been published, so it is safe to go.
|
Just realized that I can make Thoughts? |
…e implementation Replace tests which test implementation details by functional tests, so we can refactor recwarn module to simplify it by using the warnings.catch_warnings builtin, available since Python 2.6.
3a5231e to
679e92b
Compare
|
i strongly dislike how we turn all kinds of local component tests into system tests, its pretty much worst practice |
|
I agree, I was just changing them into functional because my initial take had removed the internal classes; but then afterwards I was able to keep the exact same interface as before, so we can keep the tests as they are right now. |
Replace tests which test implementation details by functional tests, so we can refactor recwarn module
to simplify it by using the warnings.catch_warnings builtin, available since Python 2.6.
I will open a new PR based upon this one with the refactor itself; I'm opening in two PRs to prove that the behavior has not changed, since I had to convert the tests to functional tests first.