title: How to include test classes with init in a Pytest test suite?
body: <p>I'm trying to create a test suite with pytest and Selenium using Page Object Models for pattern designing. For using my page classes on my tests, I just imported them inside my TestClass <code>__init__</code> method, since they need to instanced with a driver.</p>
  
  <p>I know that, by default, pytest ignores classes with an <code>__init__</code> method. I also know, by reading <a href="https://docs.pytest.org/en/latest/goodpractices.html#conventions-for-python-test-discovery" rel="nofollow noreferrer">here</a> that it's possible to configure where pytest collects tests. Is it also possible to make it consider class tests with <code>__init__</code>, instead of returning an "Empty Suite" error?</p>
  
  <pre><code>@pytest.fixture(scope="session")
  def driver_init(request):
      from selenium import webdriver
      driver = webdriver.Chrome()
      session = request.node
      page = PageFunctions(driver)
      login_page = LoginPage(driver)
      registration_page = RegistrationPage(driver)
  
      for item in session.items:
          cls = item.getparent(pytest.Class)
          setattr(cls.obj, "driver", driver)
          setattr(cls.obj, "page", page)
          setattr(cls.obj, "login", login_page)
          setattr(cls.obj, "registration", registration_page)
  </code></pre>