Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to override test suite name #25

Merged
merged 4 commits into from
Jul 13, 2022

Conversation

fmartinsons
Copy link
Contributor

Because the default might not be suitable for all usage
(full input file path without extenstion)

Signed-off-by: Frederic Martinsons frederic.martinsons@sigfox.com

cclauss added a commit that referenced this pull request May 9, 2021
cclauss added a commit that referenced this pull request May 9, 2021
* isort: —rc is now deprecated

* Add blank line to placate isort (lifted from #25)

* Make isort a mandatory test

* isort --verbose to document files skipped

* isort --verbose is too verbose
@fmartinsons
Copy link
Contributor Author

For information, please do not merge this one already (first I'll rebase and second I search how to improve xml formatting).
For the record, I work with a C test suite made using glib tests framework which output TAP (https://developer.gnome.org/glib/stable/glib-Testing.html) and I look for presenting result in junit under jenkins (thanks to https://plugins.jenkins.io/junit/).

To compare I have an xml produced by pytest framework (pytest_xml.txt

which gives this structure in jenkins:
Screenshot from 2021-05-09 08-58-48

I have also an xml (sfxlib_xml.txt produced by tap2junit from the following tap file (sfxlib_tap.txt which gives this output:

Screenshot from 2021-05-09 08-58-30

I don't understand the presences of testsuites at top of the file generated by tap2junit (while the one with pytest don't have it) and also I think the use of classname attribute may help the output (because like you can see in the screenshot, I have this ugly "(root)" at first)

Because the default might not be suitable for all usage
(full input file path without extenstion)

Signed-off-by: Frederic Martinsons <frederic.martinsons@sigfox.com>
@cclauss
Copy link
Collaborator

cclauss commented May 9, 2021

I am not a fan of naming the test to be something different than the root of the basename of in_file because...

Explicit is better than implicit. -- Zen of Python

Why not just extract name from in_file?

import os
os.path.splitext(os.path.basename("a/b/c.txt"))[0]  # 'c'

@fmartinsons
Copy link
Contributor Author

fmartinsons commented May 9, 2021

I am not a fan of naming the test to be something different than the root of the basename of in_file because...

Explicit is better than implicit. -- Zen of Python

Why not just extract name from in_file?

import os
os.path.splitext(os.path.basename("a/b/c.txt"))[0]  # 'c'

I don't see that to be a implicit vs explicit problem but to let the user choose if he wants to (because there is no special reason for using the filename currently being parsed for the testsuite name, they can be totally unrelated to what the testuiste name is).
By the way this is what pytest do for junit output , see junit_suite_name).
But what you suggest can be applied for the default behavior when no name is given. What do you think ?

Signed-off-by: Frederic Martinsons <frederic.martinsons@sigfox.com>
…Case

In order to allow a better formatting of the junit XML result and not
hardcode None into classname attribute if we can avoid it.

Add also a test with test description contains '.'

Signed-off-by: Frederic Martinsons <frederic.martinsons@sigfox.com>
Signed-off-by: Frederic Martinsons <frederic.martinsons@sigfox.com>
@fmartinsons
Copy link
Contributor Author

Hello @cclauss , any chance to land this merge request ? Is my suggestion of changing the default value of test suite name and let the option to the user suits you ?

@fmartinsons
Copy link
Contributor Author

Any news here ?

@cclauss cclauss requested a review from richardlau July 13, 2022 11:23
@cclauss cclauss merged commit af11dc2 into nodejs:main Jul 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants