pytest-tap
pytest-tap copied to clipboard
Add ability to write YAML blocks based on test decorator
As of tap version 13 YAML blocks are supported. Tappy allows for reading these YAML blocks but it would be great if the pytest tap plugin could write the YAML blocks based on some information coming from the tests themselves.
I implemented this locally using a decorator for the tests and by adding an extra hook method to the pytest tap plugin.py.
The decorator takes a string which represents the body of the YAML block, which should be added to the tap report, and adds it to the TestCase in question.
The hook method then takes this additional information and adds it to the TAP line to be written.
In this way the YAML block is defined by the test writer - it might also be nice to be able to fill the YAML block with some of the other automated outputs of tests.
I've got some code I can share but new to this area so not sure if it's the right way to do it. Links very closely to an issue I just submitted here
I can consider a PR if you can push code up to GitHub.
Abstractly, yes, it would be nice if pytest-tap could output YAML blocks in a configurable way. I'm not sure how best to expose data or how to add more information. Having some code to look through could help work through an appropriate API.
Ok will do - should I do that as a PR from a fork?
Yeah, sorry. I take it for granted that I do GitHub on a daily basis for work and not everyone knows how to do this stuff.
Here's roughly the process:
- Make a fork.
- Make a local clone.
- Make a branch in that clone.
- Write the code you want to write.
- Commit to that branch.
- Push the local branch up to the fork on GitHub.
- From the GitHub UI on the tappy page, propose a PR.
If you need more guidance, I can help along the way.
That's awesome - will get the PR up (We use Atlassian for work so not used to GitHub but pretty much the same process)