Watchful11

praw test error

Sep 22nd, 2023
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.19 KB | None | 0 0
  1.  
  2. tests\integration\models\test_inbox.py:51 (TestInbox.test_mark_unread)
  3. self = <tests.integration.models.test_inbox.TestInbox object at 0x0000024C4DC9FCA0>
  4. request = <SubRequest 'cassette' for <Function test_mark_unread>>
  5. recorder = <betamax.recorder.Betamax object at 0x0000024C4EDAEA00>
  6. cassette_name = 'TestInbox.test_mark_unread'
  7.  
  8. @pytest.fixture(autouse=True)
  9. def cassette(self, request, recorder, cassette_name):
  10. """Wrap a test in a Betamax cassette."""
  11. global used_cassettes
  12. kwargs = {}
  13. for marker in request.node.iter_markers("add_placeholder"):
  14. for key, value in marker.kwargs.items():
  15. recorder.config.default_cassette_options["placeholders"].append(
  16. {"placeholder": f"<{key.upper()}>", "replace": value}
  17. )
  18. for marker in request.node.iter_markers("recorder_kwargs"):
  19. for key, value in marker.kwargs.items():
  20. # Don't overwrite existing values since function markers are provided
  21. # before class markers.
  22. kwargs.setdefault(key, value)
  23. with recorder.use_cassette(cassette_name, **kwargs) as recorder:
  24. cassette = recorder.current_cassette
  25. if cassette.is_recording():
  26. ensure_environment_variables()
  27. yield recorder
  28. > ensure_integration_test(cassette)
  29.  
  30. tests\integration\__init__.py:60:
  31. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  32.  
  33. cassette = <betamax.cassette.cassette.Cassette object at 0x0000024C4EDAE130>
  34.  
  35. def ensure_integration_test(cassette):
  36. if cassette.is_recording():
  37. is_integration_test = not cassette.is_empty()
  38. action = "record"
  39. else:
  40. is_integration_test = any(
  41. interaction.used for interaction in cassette.interactions
  42. )
  43. action = "play back"
  44. message = f"Cassette did not {action} any requests. This test can be a unit test."
  45. > assert is_integration_test, message
  46. E AssertionError: Cassette did not play back any requests. This test can be a unit test.
  47.  
  48. tests\utils.py:42: AssertionError
  49.  
Advertisement
Add Comment
Please, Sign In to add comment