title: py.test fixture from another file
body: <p>I have the following file I want to test</p>
  
  <p>manage.py</p>
  
  <pre><code>import socket
  def __get_pod():
      try:
          pod = socket.gethostname().split("-")[-1].split(".")[0]
      except:
          pod = "Unknown"
  
      return pod
  </code></pre>
  
  <p>Here is my test script 
  tests/test_manage.py</p>
  
  <pre><code>import sys
  import pytest
  
  sys.path.append('../')
  
  from manage import __get_pod
  
  #
  # create a fixture for a softlayer IP stack
  @pytest.fixture
  def patch_socket(monkeypatch):
  
      class my_gethostname:
          @classmethod
          def gethostname(cls):
              return 'web01-east.domain.com'
  
      monkeypatch.setattr(socket, 'socket', my_gethostname)
  
  
  def test__get_pod_single_dash():
      assert __get_pod() == 'east'
  </code></pre>
  
  <p>So when I try to test it hosts my laptop hostname when I want it to use the fixture.. is it possible to use a fixture in another file?</p>
  
  <pre><code>$ py.test -v
  ======================================================================= test session starts ========================================================================
  platform darwin -- Python 2.7.8 -- py-1.4.26 -- pytest-2.6.4 -- /usr/local/opt/python/bin/python2.7
  collected 1 items
  
  test_manage.py::test__get_pod_single_dash FAILED
  
  ============================================================================= FAILURES =============================================================================
  ____________________________________________________________________ test__get_pod_single_dash _____________________________________________________________________
  
      def test__get_pod_single_dash():
  &gt;       assert __get_pod() == 'east'
  E       assert '2' == 'east'
  E         - 2
  E         + east
  </code></pre>