From b95e85ab931565233147d541738cf4ac42fbb7c3 Mon Sep 17 00:00:00 2001 From: Jiajun Xu Date: Fri, 7 Jun 2024 23:56:55 -0400 Subject: [PATCH] warns when usefixtures is empty --- src/_pytest/fixtures.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/_pytest/fixtures.py b/src/_pytest/fixtures.py index 06da52aed..a01b6bfa4 100644 --- a/src/_pytest/fixtures.py +++ b/src/_pytest/fixtures.py @@ -1525,6 +1525,8 @@ class FixtureManager: def _getusefixturesnames(self, node: nodes.Item) -> Iterator[str]: """Return the names of usefixtures fixtures applicable to node.""" for mark in node.iter_markers(name="usefixtures"): + if not mark.args: + warnings.warn(f"Warning: empty usefixtures in {node.name}.") yield from mark.args def getfixtureclosure(