From anonymous, 3 Weeks ago, written in Plain Text.
This paste will slip away in 1 Second.
Embed
  1. import pytest
  2.  
  3. @pytest.fixture
  4. def fixt(request):
  5.     marker = request.node.get_closest_marker('fixt_data')
  6.     if marker is None:
  7.         # Handle missing marker in some way...
  8.         data = None
  9.     else:
  10.         data = marker.args[0]
  11.  
  12.     # Do something with the data
  13.     return data
  14.  
  15. @pytest.mark.fixt_data((42, 41))
  16. @pytest.fixture
  17. def proxy_fixt(fixt):
  18.     filtered = fixt[0]
  19.     yield filtered
  20.  
  21.  
  22. def test_fixt2(proxy_fixt):
  23.     assert False, proxy_fixt
  24.