Skip to content

Commit 7a57536

Browse files
committed
Use pytest fixture in system test
Do background setup for the test in a fixture rather than overriding the setUp() function. Removes the need to remember to call super.setUp()
1 parent 22bafa0 commit 7a57536

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

manage_breast_screening/record_a_mammogram/tests/system/test_user_submits_cannot_go_ahead_form.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import re
2+
import pytest
23
from django.urls import reverse
34
from playwright.sync_api import expect
45

@@ -7,9 +8,9 @@
78
from manage_breast_screening.participants.tests.factories import ParticipantFactory
89
from manage_breast_screening.clinics.models import Appointment
910

10-
class UserSubmitsCannotGoAheadForm(SystemTestCase):
11-
def setUp(self):
12-
super().setUp()
11+
class TestUserSubmitsCannotGoAheadForm(SystemTestCase):
12+
@pytest.fixture(autouse=True)
13+
def before(self):
1314
self.participant = ParticipantFactory()
1415
self.screening_episode = ScreeningEpisodeFactory(participant=self.participant)
1516
self.appointment = AppointmentFactory(screening_episode=self.screening_episode)

0 commit comments

Comments
 (0)