Fixtures

Example

import pytest

@pytest.fixture
def fixtureName():
	return 123
# can be used to return objects ect... when they are needed multiple times over
# it seems to be similar to a setup function but in function based tests


def test_1(fixtureName):
	assert fixture > 0

def test_2(fixtureName):
	assert fixture < 200

Globalise fixtures

  1. make a file called conftest.py
  1. fill it with the fixtures
import pytest

@pytest.fixture
def fixtureName():
	return 123