jolly-good-toolbelt / sphinx_gherkindoc

A tool to convert Gherkin into Sphinx documentation
https://jolly-good-toolbelt.github.io/sphinx_gherkindoc/
11 stars 10 forks source link

Update for changes in new versions of pytest-bdd #54

Closed pbarnajc closed 1 year ago

pbarnajc commented 1 year ago

pytest-bdd changed how Features and Scenarios are parsed.

  1. Features no longer do the parsing, so call the parse_feature function if it exists instead.
  2. Features can no longer have examples, so check if the object has the examples attribute before trying to access it.
  3. If there are feature file parsing exceptions, report the feature file that failed to parse.
  4. Scenarios are initially parsed into a ScenarioTemplate which get turned into Scenarios and Scenario Outlines, so change the keyword for ScenarioTemplate to the appropriate form.
rbcasperson commented 1 year ago

I confirmed that this works in a project using the latest pytest-bdd version. CI for this PR should confirm it works for the old version we were pinning. Though @pbarnajc it appears that is failing (I approved it to be kicked off).

dgou commented 1 year ago

Just giving this a quick evening review, I am struck wondering if instead of having all the version checks, it might be simpler to increment our major version and pin the new pytest-bdd version at the same time. It's not like this repo has had a lot of PRs, so there isn't likely to be much work on the current major version if we do increment our major version? Will re-look tomorrow with fresher eyes.

rbcasperson commented 1 year ago

@dgou yeah I tend to agree that would be fine. I'm just not sure if that would require any updates to our tests or anything. Probably would be minimal effort, but I didn't want to force that on @pbarnajc. If it switched to a major version change and dropped support for anything but the latest major version of pytest-bdd I would still approve.

pbarnajc commented 1 year ago

I'm always in favor of supporting more versions. Only supporting the latest pytest-bdd version would honestly only change a couple lines in the __init__ method to not have the if-else and then removing the entirety of the Feature.examples property. Everything else would still be applicable. The added try-catch is just so that users can know which file caused an error since that info wasn't provided before.