Skip to content

Instantly share code, notes, and snippets.

@fruch
Created October 26, 2020 07:01
Show Gist options
  • Save fruch/851a0ba0065cbb7da7f0204d9f6e0ad7 to your computer and use it in GitHub Desktop.
Save fruch/851a0ba0065cbb7da7f0204d9f6e0ad7 to your computer and use it in GitHub Desktop.
import pytest
@pytest.fixture(scope="module")
def docker_cluster():
print("create docker")
yield "Docker Cluster"
print("killing docker")
@pytest.fixture(scope="module")
def reloc_cluster():
print("create reloc")
yield "Reloc Cluster"
print("killing reloc")
@pytest.fixture
def cluster(request):
return request.getfixturevalue(request.param)
cluster_params = pytest.mark.parametrize(
'cluster',
('docker_cluster', 'reloc_cluster'),
indirect=True
)
@cluster_params
def test_using_same_cluster(cluster):
print(cluster)
@cluster_params
def test_using_same_cqlsh(cluster):
print(cluster)
@cluster_params
def test_using_same_nodetool(cluster):
print(cluster)
if __name__ == "__main__":
pytest.main([__file__])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment