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 support for TAP version 12. #26

Merged
merged 2 commits into from
Jul 18, 2022

Conversation

fmartinsons
Copy link
Contributor

This is the consequences of two things taken from the TAP specification
document: https://testanything.org/tap-specification.html

  • version line must be the first line and is only required for TAP
    version 13, every version explicitly set below 13 is an error.
  • YAML management is only specified for version 13

Add test scenarios for version line missing and test plan at the end
(this is specified that the plan could be at the beginning of output
or at the end)

Signed-off-by: Frederic Martinsons [email protected]

@fmartinsons fmartinsons force-pushed the make-version-not-mandatory branch 3 times, most recently from b530563 to fe59719 Compare May 11, 2021 08:31
Comment on lines 73 to 77
non_empty_lines = [
line for line in source.getvalue().splitlines() if len(line.strip()) > 0
]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
non_empty_lines = [
line for line in source.getvalue().splitlines() if len(line.strip()) > 0
]
non_empty_lines = [line for line in source.getvalue().splitlines() if line]

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will not cover line with only spaces in it so I'll just suppress the len usage.

Copy link
Collaborator

@cclauss cclauss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For Node.js needs we only really to support TAP 13 which has been around for a long time and is widely supported. http://testanything.org/producers.html How would it help the Node.js community to add this complexity and support burden?

non_empty_lines = [
line for line in source.getvalue().splitlines() if len(line.strip()) > 0
]
m = RE_VERSION.match(non_empty_lines[0])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Single letter variable names died in the late 1970's. Please use self-documenting variable names.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure I'll use another names, I just was tricked by already single letter variable usage (which I'll replace also)

m = RE_VERSION.match(non_empty_lines[0])
if m:
# It is an error if version is anything below 13 (so not an int is an error)
v = int(m.groupdict()["version"])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
v = int(m.groupdict()["version"])
version = int(m.groupdict()["version"])

tap2junit/tap13.py Outdated Show resolved Hide resolved
# My test 2 comments
ok 3 /MyTest/3
not ok 4 /MyTest/3
of /MyTest/4
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a typo? (Same question for the other tap file).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh my, of course it is a typo. Thanks

@fmartinsons
Copy link
Contributor Author

fmartinsons commented May 12, 2021

For Node.js needs we only really to support TAP 13 which has been around for a long time and is widely supported. http://testanything.org/producers.html How would it help the Node.js community to add this complexity and support burden?

The link you provided shows there is still several TAP produces which doensn't use TAP 13 (I count 7 of them where it is explicitely mentionned that produces TAP 12 but I'm sure there are more if we look on details on each projects).

I don't know how to measure amount of producers using TAP 12 vs 13 and I don't know to Node.js community, but considering what I think to be a minimal support burden for TAP 12 in tap2junit (around 90% of the code parser is common), I think it may a great help for people which use tap2junit (which I understand to be a generic tool not tied to Node.js)

@fmartinsons
Copy link
Contributor Author

fmartinsons commented Jun 3, 2021

This merge requests hangs for 3 weeks now, is anything wrong with it ?
I totally understand the lack of time to support the project but I just would like to now if this will hang forever or have any chances to be merged on the master ?

Copy link
Member

@richardlau richardlau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m comfortable with these changes if it’s all that is required to support TAP 12 and the added tests will catch regressions. This project’s README does specify TAP 13 and probably should be updated if this is merged.

@fmartinsons
Copy link
Contributor Author

Ok thanks, I amended my MR to reflect the support of version 12 in README file.

@cclauss
Copy link
Collaborator

cclauss commented Jul 13, 2022

@fmartinsons Please rebase your PR because I would like to put out a new release.

@fmartinsons
Copy link
Contributor Author

@fmartinsons Please rebase your PR because I would like to put out a new release.

Oh, I must admit I totally forgot this PR since it lasts for a long time. Are you sure about rebasing this ? Did you still plan to merge this one ? Anyway, I must redo my dev env for this project since I wiped out my PC several months ago. If you think this dev is still accurate, I'll do the job in the coming days.

This is the consequences of two things taken from the TAP specification
document: https://testanything.org/tap-specification.html
  - version line must be the first line and is only required for TAP
version 13, every version explicitly set below 13 is an error.
  - YAML management is only specified for version 13

Add test scenarios for version line missing and test plan at the end
(this is specified that the plan could be at the beginning of output
or at the end)

Signed-off-by: Frederic Martinsons <[email protected]>
@fmartinsons
Copy link
Contributor Author

Ok I rebase, but I'll need to rework the parse function as it is now too complex.

Signed-off-by: Frederic Martinsons <[email protected]>
@fmartinsons
Copy link
Contributor Author

Done after reducing a little the complexity of _parse function

@cclauss cclauss merged commit 86f356c into nodejs:main Jul 18, 2022
for line in source:
if not seek_version and not in_yaml and RE_VERSION.match(line):
if not version12 and not seek_version and RE_VERSION.match(line):
Copy link
Member

@MoLow MoLow Jul 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did you test what happens when inside a yaml and the yaml contains a version line? thats why this tested fornot in_yaml

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cclauss @fmartinsons this has broken #31

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh my, this was a mistake.
This flag may have removed when I resolved conflict on my branch.
I open #35 to fix that. Sorry

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, I found that out when working on #34

fmartinsons added a commit to fmartinsons/tap2junit that referenced this pull request Jul 18, 2022
This is especially usefull when a version line is contained
inside a yaml block

Signed-off-by: Frederic Martinsons <[email protected]>
fmartinsons added a commit to fmartinsons/tap2junit that referenced this pull request Jul 18, 2022
This is especially usefull when a version line is contained
inside a yaml block

Signed-off-by: Frederic Martinsons <[email protected]>
fmartinsons added a commit to fmartinsons/tap2junit that referenced this pull request Jul 18, 2022
This is especially usefull when a version line is contained
inside a yaml block

Signed-off-by: Frederic Martinsons <[email protected]>
cclauss pushed a commit that referenced this pull request Jul 18, 2022
This is especially usefull when a version line is contained
inside a yaml block

Signed-off-by: Frederic Martinsons <[email protected]>
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.

4 participants