title: Why cant unittest.TestCases see my py.test fixtures?
body: <p>I'm trying to use <code>py.test</code>'s <a href="https://pytest.org/latest/fixture.html">fixtures</a> with my unit tests, in conjunction with <code>unittest</code>. I've put several fixtures in a <code>conftest.py</code> file at the top level of the project (as described <a href="https://pytest.org/latest/fixture.html#shifting-visibility-of-fixture-functions">here</a>), decorated them with <code>@pytest.fixture</code>, and put their names as arguments to the test functions that require them.</p>
  
  <p>The fixtures are registering correctly, as shown by <code>py.test --fixtures test_stuff.py</code>, but when I run <code>py.test</code>, I get <code>NameError: global name 'my_fixture' is not defined</code>. This appears to only occur when I use subclasses of <code>unittest.TestCase</code>—but the <code>py.test</code> docs seem to say that it plays well with <code>unittest</code>.</p>
  
  <p>Why can't the tests see the fixtures when I use <code>unittest.TestCase</code>?</p>
  
  <hr>
  
  <h2>Doesn't work:</h2>
  
  <h3>conftest.py</h3>
  
  <pre><code>@pytest.fixture
  def my_fixture():
      return 'This is some fixture data'
  </code></pre>
  
  <h3>test_stuff.py</h3>
  
  <pre><code>import unittest
  import pytest
  
  class TestWithFixtures(unittest.TestCase):
  
      def test_with_a_fixture(self, my_fixture):
           print(my_fixture)
  </code></pre>
  
  <hr>
  
  <h2>Works:</h2>
  
  <h3>conftest.py</h3>
  
  <pre><code>@pytest.fixture()
  def my_fixture():
      return 'This is some fixture data'
  </code></pre>
  
  <h3>test_stuff.py</h3>
  
  <pre><code>import pytest
  
  class TestWithFixtures:
  
      def test_with_a_fixture(self, my_fixture):
           print(my_fixture)
  </code></pre>
  
  <hr>
  
  <p>I'm asking this question more out of curiosity; for now I'm just ditching <code>unittest</code> altogether.</p>