You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
when running pytest with --numprocesses=4 (or any non 0 number) if you generate an xml or json report using the json plugin and some of the modules fail during collection, xdist will cause pytest to generate a collector error for the same file for each worker. ex.: 4 processes will cause 4 entries for each failed collection, 2 processes -> 2 entries per failed collection etc.
also, when running using json report, normally the collectors key should be added for all collected files but when using xdist only failed collections get added.
example with --numprocesses=4 and 2 files: 1 that fails during collection and 1 that doesn't. notice how none of the successful collections show up and the failed collection shows up 4 times.
correct output: when using --numprocesses=0 all collected items are shown including the successful ones and the failed collections only show once per file.
to cause a collection error you can raise an exception at the top of the file or you can import a class that raises an exception inside its __init__ method.
raiseException("testing expection from module")
deftest_import_exception(session_id: str):
print(session_id)
assertTruereturn
or
fromsome.folderimportInvalidImportdeftest_import_exception(session_id: str):
print(session_id)
assertTruereturn# some.folderclassInvalidImport:
raiseException("testing exception from import")
this affects the pytest xml as well in that the failed collections get printed there multiple times as well, the difference being that xml doesn't have a collectors section, so no successful collections show up.
The text was updated successfully, but these errors were encountered:
hi,
when running pytest with
--numprocesses=4
(or any non 0 number) if you generate an xml or json report using the json plugin and some of the modules fail during collection, xdist will cause pytest to generate a collector error for the same file for each worker. ex.: 4 processes will cause 4 entries for each failed collection, 2 processes -> 2 entries per failed collection etc.json example when using
--numprocesses=4
correct output when using
--numprocesses=0
also, when running using json report, normally the
collectors
key should be added for all collected files but when using xdist only failed collections get added.example with
--numprocesses=4
and 2 files: 1 that fails during collection and 1 that doesn't. notice how none of the successful collections show up and the failed collection shows up 4 times.correct output: when using
--numprocesses=0
all collected items are shown including the successful ones and the failed collections only show once per file.to cause a collection error you can raise an exception at the top of the file or you can import a class that raises an exception inside its
__init__
method.or
this affects the pytest xml as well in that the failed collections get printed there multiple times as well, the difference being that xml doesn't have a collectors section, so no successful collections show up.
The text was updated successfully, but these errors were encountered: