Closed arthurHamon2 closed 5 years ago
Thank you for looking into this, and sorry for not replying earlier. I'll try to test those changes over the weekend.
wt., 16 kwi 2019, 07:27 użytkownik Arthur Hamon notifications@github.com napisał:
A weird thing happens with pytest 4.X.X when using vcr on a "unittest.TestCase" class, the cassette name do not have the class name anymore compared with pytest 3.X.X.
The cassette name did not include the class name if it inherits from unittest.TestCase, use the attribute "request.cls" to get the class instead of relying on hasattr(request.function, 'self').
You can view, comment on, or merge this pull request online at:
https://github.com/ktosiek/pytest-vcr/pull/20 Commit Summary
- fix - regression on handling the cassette name in a class that inherits from unittest.TestCase
File Changes
- M pytest_vcr.py https://github.com/ktosiek/pytest-vcr/pull/20/files#diff-0 (6)
- M tests/test_vcr.py https://github.com/ktosiek/pytest-vcr/pull/20/files#diff-1 (23)
Patch Links:
- https://github.com/ktosiek/pytest-vcr/pull/20.patch
- https://github.com/ktosiek/pytest-vcr/pull/20.diff
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ktosiek/pytest-vcr/pull/20, or mute the thread https://github.com/notifications/unsubscribe-auth/AAQ9_WfBovdNZb66PHn28u24F5ftKDDUks5vhV85gaJpZM4cxYwr .
No worries, this is a very specific case where we are moving from setUp/tearDown pattern to pytest with fixtures. Sometimes we end up using vcrpy in a old unittest.TestCase (which is bad). At the moment we override the fixture "vcr_cassette_name" to take care of this issue, but I guess this fix would help the community if someone encounters the same issue. Thank you for your response and your time, really appreciated !
A weird thing happens with pytest 4.X.X when using vcr on a "unittest.TestCase" class, the cassette name do not have the class name anymore compared with pytest 3.X.X.
The cassette name did not include the class name if it inherits from unittest.TestCase, use the attribute "request.cls" to get the class instead of relying on hasattr(request.function, 'self').