Following code does not collect any test cases (i expect 4 to be found). Why?
import pytest
import uuid
from selenium import webdriver
from selenium.common.exceptions import TimeoutException
class TestClass:
def __init__(self):
self.browser = webdriver.Remote(
desired_capabilities=webdriver.DesiredCapabilities.FIREFOX,
command_executor='http://my-selenium:4444/wd/hub'
)
@pytest.mark.parametrize('data', [1,2,3,4])
def test_buybuttons(self, data):
self.browser.get('http://example.com/' + data)
assert '<noindex>' not in self.browser.page_source
def __del__(self):
self.browser.quit()
If i remove __init__
and __del__
methods, it will collect tests correctly. But how i can setup and tear test down? :/