title: How to separate tests and fixtures
body: <p>I have example project in PyCharm - consist of a simple test that checking sign-in to the given correct Slack workspace. It has <code>web_drivers</code> directory with <code>chromedriver</code> inside, <code>conftest.py</code> with webdriver setup for test and <code>tests.py</code> with actual test, f.e.</p>
  
  <blockquote>
    <p>conftest.py</p>
  </blockquote>
  
  <pre><code>import os
  import pytest
  from selenium import webdriver
  
  @pytest.fixture(scope='class')
  def driver_get(request):
      web_driver = webdriver.Chrome(executable_path=os.path.join("web_drivers","chromedriver.exe"))
      yield web_driver
  
  def fin():
      web_driver.close()
  
  request.addfinalizer(fin)
  </code></pre>
  
  <blockquote>
    <p>tests.py</p>
  </blockquote>
  
  <pre><code>import pytest
  
  class TestSlackWorkspace(object):
      @pytest.fixture(autouse=True)
      def setup(self, driver_get):
          self.driver = driver_get
          self.driver.get("https://slack.com/signin")
          self.input_field = self.driver.find_element_by_xpath(
          "//input[@type='text' and @id='domain']")
          self.continue_button = self.driver.find_element_by_xpath(
          "//button[@id='submit_team_domain']")
  
      def test_correct_workspace(self):
          self.input_field.send_keys("test")
          self.continue_button.click()
          assert self.driver.find_element_by_xpath("//h1[@id='signin_header']"
          ).is_displayed(), "Login page should be displayed"
  </code></pre>
  
  <p>Now the question is to divide test to the page initialization part - <code>def setup</code>, and actual test execution part - <code>def test_correct_workspace</code> to the different classes and files(something like Page Object Pattern)</p>
  
  <p>So base of <code>conftest.py</code> should be the same, and divide <code>test.py</code> to i.e.</p>
  
  <blockquote>
    <p>page.py</p>
  </blockquote>
  
  <pre><code>class SlackWorkspace(object):
      @pytest.fixture(autouse=True)
      def __init__(self, driver_get):
          self.driver = driver_get
          self.driver.get("https://slack.com/signin")
          self.input_field = self.driver.find_element_by_xpath("//input[@type='text' and @id='domain']")
          self.continue_button = self.driver.find_element_by_xpath("//button[@id='submit_team_domain']")
  </code></pre>
  
  <blockquote>
    <p>test.py</p>
  </blockquote>
  
  <pre><code>class TestWorkspace(object):
      def test_correct_workspace(self):
          self.input_field.send_keys("test")
          self.continue_button.click()
          login_page = self.driver.find_element_by_xpath("//h1[@id='signin_header']")
          assert login_page.is_displayed(), "Login page should be displayed"
  </code></pre>
  
  <p>But for sure it will not work in that form:</p>
  
  <p>1) Somehow <code>driver_get</code> should be imported to page initialization file and forwarder to <code>__init__</code> - ?</p>
  
  <p>2) Somehow page initialization should be linked with test realization in other files-?</p>
  
  <p>Have no idea how to organize all these imports between separate files</p>