-
Notifications
You must be signed in to change notification settings - Fork 221
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
Tags support for Example sections #413
Conversation
Updates from upstream
Codecov Report
@@ Coverage Diff @@
## master #413 +/- ##
==========================================
+ Coverage 96.00% 96.62% +0.61%
==========================================
Files 50 50
Lines 1679 1748 +69
Branches 159 166 +7
==========================================
+ Hits 1612 1689 +77
+ Misses 39 32 -7
+ Partials 28 27 -1
Continue to review full report at Codecov.
|
06bfb00
to
dc55288
Compare
Hi, this is a really helpful feature! What is the status of this issue? |
Indeed, this is a very expected feature !! +1 |
It is a very expected feature! |
pytest_bdd requires original parser to be rewritten. This PR uses and extends old parser, so seems that this PR won't be accepted till work on new parser would be finished(and has to be re-done after) I'm in progress of development fork of pytest_bdd which uses cucumber.io gherkin parser, which will support this feature from the box (essential for project which I test), but won't get support of code generation and maybe other features of pytest_bdd on start. I think it could take few weeks to show this feature, because I'm busy on my main project |
- Example tags could be used for test selection - Example tags could not be used for invoking pytest_bdd_apply_tag hook for now - Add explicit support for multiple Examples sections - "Examples: Vertical" replaced with "Examples Transposed:" for more convenient naming - Examples sections names are parsed (not used now)
dc55288
to
f250ea6
Compare
@@ -267,12 +288,20 @@ def params(self): | |||
|
|||
def get_example_params(self): | |||
"""Get example parameter names.""" | |||
return set(self.examples.example_params + self.feature.examples.example_params) | |||
return set( | |||
chain( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{examples.example_params for examples in chain(...)}?
return [self.example_params, params] | ||
else: | ||
return [] | ||
self.examples = list(zip(*self.example_param_values)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that looks weird. why does it assign to self in get_() function instead of return?
for param_names in scenario_param_data.keys(): | ||
parametrize_values = [] | ||
for param_tags, param_values in scenario_param_data[param_names]: | ||
marks = list(map(partial(getattr, pytest.mark), param_tags)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
marks = [...]
|
||
decorator_chain.append(pytest.mark.parametrize(list(param_names), parametrize_values)) | ||
|
||
compose = lambda *func: reduce(lambda f, g: lambda x: f(g(x)), func, lambda x: x) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay.. let's not turn python into haskell
@@ -496,13 +496,13 @@ pytest-bdd feature file format also supports example tables in different way: | |||
When I eat <eat> cucumbers | |||
Then I should have <left> cucumbers | |||
|
|||
Examples: Vertical | |||
Examples Transposed: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to separate tags from transposed examples into separate PRs? It is very hard to follow what's what
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will be reopened after #475 merge |
Hey, I see this is waiting for #475, but the other issue is closed now and the branch is deleted. Kindly suggest when would this be available or if there exists any alternatives. Regards, |
@CuriousQA seems, that this feature (and many others attached to it) won't be implemented in this project, because of internal problems that must be unwrapped at first. The biggest one is a rewriting parser of Gherkin files. This activity seems ongoing, so I decided to make a fork of this project, to have the possibility to implement essential features which I need personally. That fork supports tags for example sections but doesn't support vertical examples (because they are not a part of the "standard"). You could find it here https://github.com/elchupanebrej/pytest-bdd-ng |
Thank you @elchupanebrej for your response. I will look into the link you shared it. |
This covers #411