@@ -865,7 +865,7 @@ def yield_fixture(scope="function", params=None, autouse=False, ids=None, name=N
865
865
return FixtureFunctionMarker (scope , params , autouse , ids = ids , name = name )
866
866
867
867
defaultfuncargprefixmarker = fixture ()
868
- funcarg_prefix_warning = 'declaring fixtures using "pytest_funcarg__" prefix is deprecated ' \
868
+ funcarg_prefix_warning = '{name}: declaring fixtures using "pytest_funcarg__" prefix is deprecated ' \
869
869
'and scheduled to be removed in pytest 4.0.\n ' \
870
870
'remove the prefix and use the @pytest.fixture decorator instead'
871
871
@@ -1046,16 +1046,18 @@ def parsefactories(self, node_or_obj, nodeid=NOTSET, unittest=False):
1046
1046
if not callable (obj ):
1047
1047
continue
1048
1048
marker = defaultfuncargprefixmarker
1049
+ self .config .warn ('C1' , funcarg_prefix_warning .format (name = name ))
1049
1050
name = name [len (self ._argprefix ):]
1050
- self .config .warn ('C1' , funcarg_prefix_warning )
1051
1051
elif not isinstance (marker , FixtureFunctionMarker ):
1052
1052
# magic globals with __getattr__ might have got us a wrong
1053
1053
# fixture attribute
1054
1054
continue
1055
1055
else :
1056
1056
if marker .name :
1057
1057
name = marker .name
1058
- assert not name .startswith (self ._argprefix ), name
1058
+ msg = 'fixtures cannot have "pytest_funcarg__" prefix ' \
1059
+ 'and be decorated with @pytest.fixture:\n %s' % name
1060
+ assert not name .startswith (self ._argprefix ), msg
1059
1061
fixturedef = FixtureDef (self , nodeid , name , obj ,
1060
1062
marker .scope , marker .params ,
1061
1063
unittest = unittest , ids = marker .ids )
0 commit comments