Skip to content

Commit 7af5551

Browse files
committed
test(session): Improve PeriodRaisesBadSessionName test with test_id and constant list
1 parent 25b6423 commit 7af5551

File tree

1 file changed

+24
-6
lines changed

1 file changed

+24
-6
lines changed

Diff for: tests/test_session.py

+24-6
Original file line numberDiff line numberDiff line change
@@ -221,21 +221,39 @@ def test_unset_environment(session: Session) -> None:
221221
class PeriodRaisesBadSessionName(t.NamedTuple):
222222
"""Test fixture for bad session name names."""
223223

224+
test_id: str
224225
session_name: str
225226
raises: bool
226227

227228

229+
PERIOD_RAISES_BAD_SESSION_NAME_FIXTURES: list[PeriodRaisesBadSessionName] = [
230+
PeriodRaisesBadSessionName(
231+
test_id="period_in_name",
232+
session_name="hey.period",
233+
raises=True,
234+
),
235+
PeriodRaisesBadSessionName(
236+
test_id="colon_in_name",
237+
session_name="hey:its a colon",
238+
raises=True,
239+
),
240+
PeriodRaisesBadSessionName(
241+
test_id="valid_name",
242+
session_name="hey moo",
243+
raises=False,
244+
),
245+
]
246+
247+
228248
@pytest.mark.parametrize(
229-
PeriodRaisesBadSessionName._fields,
230-
[
231-
PeriodRaisesBadSessionName("hey.period", True),
232-
PeriodRaisesBadSessionName("hey:its a colon", True),
233-
PeriodRaisesBadSessionName("hey moo", False),
234-
],
249+
list(PeriodRaisesBadSessionName._fields),
250+
PERIOD_RAISES_BAD_SESSION_NAME_FIXTURES,
251+
ids=[test.test_id for test in PERIOD_RAISES_BAD_SESSION_NAME_FIXTURES],
235252
)
236253
def test_periods_raise_bad_session_name(
237254
server: Server,
238255
session: Session,
256+
test_id: str,
239257
session_name: str,
240258
raises: bool,
241259
) -> None:

0 commit comments

Comments
 (0)