pytest icon indicating copy to clipboard operation
pytest copied to clipboard

Allow junit_suite_name to be set on any grouping of tests and in a nested manner

Open sebovzeoueb opened this issue 4 weeks ago • 0 comments

What's the problem this feature will solve?

Currently it's only possible to set the name of the root suite when running tests, but other frameworks such as jest will create nested test suite elements using the labels provided in the test files. I'm using a JUnit merging tool to assemble several test reports into one file and it uses the test suite names to do so, all my tests from the JavaScript portion of the project using jest are neatly sorted into groups but all my pytest results get lumped into a single suite, I can mitigate this slightly with the junit_suite_name option in the CLI but it only applies to the root element and doesn't support nesting.

Describe the solution you'd like

I think a function you can call anywhere in the file structure that sets a suite name would work here. For example if you call it in the __init__.py of a module, that whole module will be under that suite name, you could also call it in a file, class or individual test. If there were a call at the module level and another at the file level, this would create a file suite nested inside the module suite.

sebovzeoueb avatar Nov 13 '25 20:11 sebovzeoueb