behave-cucumber-parser 1.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- behave_cucumber_parser-1.1.0/.gitignore +3 -0
- behave_cucumber_parser-1.1.0/.gitlab-ci.yml +82 -0
- behave_cucumber_parser-1.1.0/LICENSE +30 -0
- behave_cucumber_parser-1.1.0/PKG-INFO +39 -0
- behave_cucumber_parser-1.1.0/README.md +66 -0
- behave_cucumber_parser-1.1.0/conf.py +60 -0
- behave_cucumber_parser-1.1.0/dependencies/build.apt.requirements +6 -0
- behave_cucumber_parser-1.1.0/dependencies/build.requirements.txt +10 -0
- behave_cucumber_parser-1.1.0/dependencies/docu.apt.requirements +6 -0
- behave_cucumber_parser-1.1.0/dependencies/docu.requirements.txt +15 -0
- behave_cucumber_parser-1.1.0/dependencies/runtime.apt.requirements +3 -0
- behave_cucumber_parser-1.1.0/dependencies/runtime.requirements.txt +7 -0
- behave_cucumber_parser-1.1.0/dependencies/test.apt.requirements +3 -0
- behave_cucumber_parser-1.1.0/dependencies/test.requirements.txt +5 -0
- behave_cucumber_parser-1.1.0/docu/devEnvironment.md +129 -0
- behave_cucumber_parser-1.1.0/docu/features.md +78 -0
- behave_cucumber_parser-1.1.0/docu/patches.md +35 -0
- behave_cucumber_parser-1.1.0/docu/updateFromTemplate.md +47 -0
- behave_cucumber_parser-1.1.0/features/.markdownlint.jsonc +20 -0
- behave_cucumber_parser-1.1.0/features/MarkdownWithGherkin.feature.md +104 -0
- behave_cucumber_parser-1.1.0/features/test_behave.ini +5 -0
- behave_cucumber_parser-1.1.0/features/test_environment.py +12 -0
- behave_cucumber_parser-1.1.0/features/test_steps/gherkin_cli_steps.py +75 -0
- behave_cucumber_parser-1.1.0/index.rst +13 -0
- behave_cucumber_parser-1.1.0/metadata.json +49 -0
- behave_cucumber_parser-1.1.0/pth/behave_cucumber_parser.pth +5 -0
- behave_cucumber_parser-1.1.0/pyproject.toml +122 -0
- behave_cucumber_parser-1.1.0/setup.base.sh +28 -0
- behave_cucumber_parser-1.1.0/setup.debian.sh +33 -0
- behave_cucumber_parser-1.1.0/setup.env.sh +22 -0
- behave_cucumber_parser-1.1.0/setup.python.sh +24 -0
- behave_cucumber_parser-1.1.0/src/__init__.py +1 -0
- behave_cucumber_parser-1.1.0/src/adapter/__init__.py +8 -0
- behave_cucumber_parser-1.1.0/src/adapter/backgroundCucumber2Behave.py +29 -0
- behave_cucumber_parser-1.1.0/src/adapter/childrenCucumber2Behave.py +50 -0
- behave_cucumber_parser-1.1.0/src/adapter/examplesCucumber2Behave.py +64 -0
- behave_cucumber_parser-1.1.0/src/adapter/featureCucumber2Behave.py +44 -0
- behave_cucumber_parser-1.1.0/src/adapter/is_feature_file.py +10 -0
- behave_cucumber_parser-1.1.0/src/adapter/ruleCucumber2Behave.py +41 -0
- behave_cucumber_parser-1.1.0/src/adapter/scenarioCucumber2Behave.py +54 -0
- behave_cucumber_parser-1.1.0/src/adapter/stepCucumber2Behave.py +66 -0
- behave_cucumber_parser-1.1.0/src/adapter/tableCucumber2Behave.py +34 -0
- behave_cucumber_parser-1.1.0/src/adapter/tagCucumber2Behave.py +19 -0
- behave_cucumber_parser-1.1.0/src/adapter/textCucumber2Behave.py +18 -0
- behave_cucumber_parser-1.1.0/src/patches/BEHAVE_LICENSE.md +36 -0
- behave_cucumber_parser-1.1.0/src/patches/__init__.py +8 -0
- behave_cucumber_parser-1.1.0/src/patches/collect_feature_locations.md +47 -0
- behave_cucumber_parser-1.1.0/src/patches/collect_feature_locations.py +44 -0
- behave_cucumber_parser-1.1.0/src/patches/install.md +12 -0
- behave_cucumber_parser-1.1.0/src/patches/install.py +25 -0
- behave_cucumber_parser-1.1.0/src/patches/parse_features.md +19 -0
- behave_cucumber_parser-1.1.0/src/patches/parse_features.py +32 -0
- behave_cucumber_parser-1.1.0/src/patches/setup_paths.md +38 -0
- behave_cucumber_parser-1.1.0/src/patches/setup_paths.py +92 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
|
|
2
|
+
stages:
|
|
3
|
+
- build
|
|
4
|
+
- test
|
|
5
|
+
- deploy
|
|
6
|
+
- cleanup
|
|
7
|
+
- release
|
|
8
|
+
|
|
9
|
+
include:
|
|
10
|
+
# Build documentation
|
|
11
|
+
- component: $CI_SERVER_FQDN/pm-virutallab/workflow/automatic-docu-generation/docuPipeline@1.2.0
|
|
12
|
+
inputs:
|
|
13
|
+
# Sphinx arguments
|
|
14
|
+
source: "."
|
|
15
|
+
output: "bin"
|
|
16
|
+
# Environment arguments
|
|
17
|
+
pipDependencies:
|
|
18
|
+
- "-r dependencies/docu.requirements.txt"
|
|
19
|
+
# Pipeline settings
|
|
20
|
+
buildStage: "build"
|
|
21
|
+
deployStage: "deploy"
|
|
22
|
+
needs: []
|
|
23
|
+
tags:
|
|
24
|
+
- "saas-linux-small-amd64"
|
|
25
|
+
expireIn: 1 week
|
|
26
|
+
|
|
27
|
+
# Build, test, deploy and cleanup the python package
|
|
28
|
+
# Uses the "build"/"buildApt" environment declared in pyproject.toml
|
|
29
|
+
- component: $CI_SERVER_FQDN/pm-virutallab/workflow/python-packaging/pythonPackagePipeline@1.1.0
|
|
30
|
+
inputs:
|
|
31
|
+
# Build arguments
|
|
32
|
+
source: "."
|
|
33
|
+
output: "bin/dist"
|
|
34
|
+
buildEnvironment: "build"
|
|
35
|
+
# Test arguments
|
|
36
|
+
testEnvironments:
|
|
37
|
+
- test
|
|
38
|
+
testReportsDirectory: bin/test/reports
|
|
39
|
+
# Deploy arguments
|
|
40
|
+
pypiDeploy: true
|
|
41
|
+
pypiTrustedPublishing: true
|
|
42
|
+
# Pipeline settings
|
|
43
|
+
buildJob: "build-python-package"
|
|
44
|
+
testJobPrefix: "test-python-package"
|
|
45
|
+
deployJob: "deploy-python-package"
|
|
46
|
+
pypiDeployJob: "deploy-python-package-pypi"
|
|
47
|
+
cleanupJob: "cleanup-python-package"
|
|
48
|
+
buildStage: "build"
|
|
49
|
+
testStage: "test"
|
|
50
|
+
deployStage: "deploy"
|
|
51
|
+
cleanupStage: "cleanup"
|
|
52
|
+
needs: []
|
|
53
|
+
tags:
|
|
54
|
+
- "saas-linux-small-amd64"
|
|
55
|
+
expireIn: 1 week
|
|
56
|
+
|
|
57
|
+
# If the pipeline is for a new tag with a semantic version, and all previous
|
|
58
|
+
# jobs succeed, create the release.
|
|
59
|
+
create-release:
|
|
60
|
+
stage: release
|
|
61
|
+
image: registry.gitlab.com/gitlab-org/cli:latest
|
|
62
|
+
before_script: []
|
|
63
|
+
script: echo "Creating release $CI_COMMIT_TAG"
|
|
64
|
+
needs:
|
|
65
|
+
- build-docu-pdf
|
|
66
|
+
- deploy-docu-pages-tag
|
|
67
|
+
- build-python-package
|
|
68
|
+
rules:
|
|
69
|
+
- if: $CI_COMMIT_TAG
|
|
70
|
+
release:
|
|
71
|
+
tag_name: $CI_COMMIT_TAG
|
|
72
|
+
description: "Release $CI_COMMIT_TAG of $CI_PROJECT_PATH"
|
|
73
|
+
assets:
|
|
74
|
+
links:
|
|
75
|
+
- name: Online Documentation
|
|
76
|
+
url: $deploy_docu_pages_tag_url
|
|
77
|
+
- name: PDF Documentation
|
|
78
|
+
url: $build_docu_pdf_url
|
|
79
|
+
- name: Python binary package
|
|
80
|
+
url: $build_python_package_whl_url
|
|
81
|
+
- name: Source distribution
|
|
82
|
+
url: $build_python_package_sdist_url
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
Copyright (c) 2026, Paul Markstädter
|
|
2
|
+
|
|
3
|
+
Redistribution and use in source and binary forms, with or without
|
|
4
|
+
modification, are permitted provided that the following conditions are met:
|
|
5
|
+
|
|
6
|
+
1. Redistributions of source code must retain the above copyright notice,
|
|
7
|
+
this list of conditions and the following disclaimer.
|
|
8
|
+
|
|
9
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
10
|
+
this list of conditions and the following disclaimer in the documentation
|
|
11
|
+
and/or other materials provided with the distribution.
|
|
12
|
+
|
|
13
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
14
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
15
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
16
|
+
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
|
17
|
+
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
18
|
+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
19
|
+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
20
|
+
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
21
|
+
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
22
|
+
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
23
|
+
POSSIBILITY OF SUCH DAMAGE.
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
This project also contains code adapted from behave
|
|
28
|
+
(https://github.com/behave/behave), used and modified under its own
|
|
29
|
+
BSD-2-Clause license — see src/patches/BEHAVE_LICENSE.md for the full
|
|
30
|
+
upstream notice and src/patches/ for what was adapted and why.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: behave_cucumber_parser
|
|
3
|
+
Version: 1.1.0
|
|
4
|
+
Summary: Parses feature files with gherkin-official, cucumber's own reference Gherkin parser, instead of behave's built-in parser, so upcoming Gherkin changes such as Markdown with Gherkin can be adopted before behave supports them natively.
|
|
5
|
+
Project-URL: Homepage, https://gitlab.com/pm-virutallab/workflow/behave-cucumber-parser
|
|
6
|
+
Project-URL: Repository, https://gitlab.com/pm-virutallab/workflow/behave-cucumber-parser
|
|
7
|
+
Project-URL: Documentation, https://behave-cucumber-parser-c2df5d.gitlab.io/
|
|
8
|
+
Project-URL: Issues, https://gitlab.com/pm-virutallab/workflow/behave-cucumber-parser/-/work_items
|
|
9
|
+
Author-email: Paul Markstädter <paul.markstaedter.git@mailbox.org>
|
|
10
|
+
Maintainer-email: Paul Markstädter <paul.markstaedter.git@mailbox.org>
|
|
11
|
+
License-Expression: BSD-2-Clause
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
License-File: src/patches/BEHAVE_LICENSE.md
|
|
14
|
+
Requires-Dist: behave>=1.3.3
|
|
15
|
+
Requires-Dist: gherkin-official>=41.0.0
|
|
16
|
+
Provides-Extra: build
|
|
17
|
+
Requires-Dist: build>=1.5.0; extra == 'build'
|
|
18
|
+
Requires-Dist: hatch-requirements-txt>=0.4.1; extra == 'build'
|
|
19
|
+
Requires-Dist: hatchling>=1.29.0; extra == 'build'
|
|
20
|
+
Requires-Dist: versioningit>=3.3.0; extra == 'build'
|
|
21
|
+
Provides-Extra: buildapt
|
|
22
|
+
Requires-Dist: git; extra == 'buildapt'
|
|
23
|
+
Requires-Dist: python3; extra == 'buildapt'
|
|
24
|
+
Requires-Dist: python3-venv; extra == 'buildapt'
|
|
25
|
+
Provides-Extra: docu
|
|
26
|
+
Requires-Dist: myst-parser>=5.1.0; extra == 'docu'
|
|
27
|
+
Requires-Dist: sphinx-autobuild>=2025.8.25; extra == 'docu'
|
|
28
|
+
Requires-Dist: sphinx-book-theme>=1.2.0; extra == 'docu'
|
|
29
|
+
Requires-Dist: sphinx>=9.1.0; extra == 'docu'
|
|
30
|
+
Requires-Dist: versioningit>=3.3.0; extra == 'docu'
|
|
31
|
+
Provides-Extra: docuapt
|
|
32
|
+
Requires-Dist: texlive-full; extra == 'docuapt'
|
|
33
|
+
Provides-Extra: runtime
|
|
34
|
+
Requires-Dist: behave>=1.3.3; extra == 'runtime'
|
|
35
|
+
Requires-Dist: gherkin-official>=41.0.0; extra == 'runtime'
|
|
36
|
+
Provides-Extra: runtimeapt
|
|
37
|
+
Provides-Extra: test
|
|
38
|
+
Requires-Dist: behave>=1.3.3; extra == 'test'
|
|
39
|
+
Provides-Extra: testapt
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# Behave Cucumber Parser
|
|
2
|
+
|
|
3
|
+
[](https://gitlab.com/pm-virutallab/workflow/behave-cucumber-parser/-/commits/main)
|
|
4
|
+
[](https://gitlab.com/pm-virutallab/workflow/behave-cucumber-parser/-/releases)
|
|
5
|
+
[](LICENSE)
|
|
6
|
+
|
|
7
|
+
Parses feature files with [gherkin-official](https://pypi.org/project/gherkin-official/),
|
|
8
|
+
cucumber's own reference Gherkin parser, instead of behave's built-in
|
|
9
|
+
parser, so upcoming Gherkin changes such as
|
|
10
|
+
[Markdown with Gherkin](https://github.com/cucumber/gherkin/blob/main/MARKDOWN_WITH_GHERKIN.md)
|
|
11
|
+
can be adopted before behave supports them natively.
|
|
12
|
+
|
|
13
|
+
## Project Structure
|
|
14
|
+
|
|
15
|
+
```md
|
|
16
|
+
project/
|
|
17
|
+
├── dependencies/ # Python/Debian dependency lists, one pair per environment
|
|
18
|
+
│ ├── build.requirements.txt / build.apt.requirements
|
|
19
|
+
│ ├── docu.requirements.txt / docu.apt.requirements
|
|
20
|
+
│ ├── runtime.requirements.txt / runtime.apt.requirements
|
|
21
|
+
│ └── test.requirements.txt / test.apt.requirements
|
|
22
|
+
├── docu/ # Documentation source files (Sphinx / Markdown)
|
|
23
|
+
│ ├── devEnvironment.md # How to set up the local development environment
|
|
24
|
+
│ ├── features.md # Feature overview (pulls in files from features/)
|
|
25
|
+
│ ├── patches.md # What behave internals are overridden, and why
|
|
26
|
+
│ └── updateFromTemplate.md # How to pull updates from the project template
|
|
27
|
+
├── features/ # Gherkin feature files — machine-readable requirements
|
|
28
|
+
│ ├── MarkdownWithGherkin.feature.md
|
|
29
|
+
│ ├── test_behave.ini # behave preset for the "test" environment
|
|
30
|
+
│ ├── test_environment.py
|
|
31
|
+
│ └── test_steps/
|
|
32
|
+
├── src/ # Python package source, packaged as behave_cucumber_parser
|
|
33
|
+
│ ├── adapter/ # Cucumber-Gherkin AST -> behave model conversion
|
|
34
|
+
│ └── patches/ # behave internals overrides + install.py, see docu/patches.md
|
|
35
|
+
├── setup.env.sh # Install an environment's Python + Debian dependencies
|
|
36
|
+
├── setup.debian.sh / setup.python.sh / setup.base.sh
|
|
37
|
+
├── .gitignore
|
|
38
|
+
├── .gitlab-ci.yml # CI/CD pipeline: build docs, package, test, deploy, cleanup, release
|
|
39
|
+
├── conf.py # Sphinx documentation configuration
|
|
40
|
+
├── index.rst # Sphinx documentation root (table of contents)
|
|
41
|
+
├── LICENSE # This project's own license (BSD-2-Clause)
|
|
42
|
+
└── pyproject.toml # Project metadata, versioning and dependency configuration
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Development
|
|
46
|
+
|
|
47
|
+
- [Set up the development environment](docu/devEnvironment.md)
|
|
48
|
+
- [Features](docu/features.md) describing functionality of this project
|
|
49
|
+
- [Patches](docu/patches.md) describing which behave internals are overridden, and why
|
|
50
|
+
- [Update from template](docu/updateFromTemplate.md) when the template changes
|
|
51
|
+
- The project is packaged and released via the
|
|
52
|
+
[pythonPackagePipeline](https://gitlab.com/pm-virutallab/workflow/python-packaging)
|
|
53
|
+
GitLab CI/CD Catalog component, wired up in [.gitlab-ci.yml](.gitlab-ci.yml)
|
|
54
|
+
|
|
55
|
+
## License
|
|
56
|
+
|
|
57
|
+
This project is licensed under [BSD-2-Clause](LICENSE).
|
|
58
|
+
|
|
59
|
+
It depends on [gherkin-official](https://pypi.org/project/gherkin-official/)
|
|
60
|
+
(MIT license) as its underlying Cucumber/Gherkin parser, used unmodified as
|
|
61
|
+
a regular dependency — no source is copied from it.
|
|
62
|
+
|
|
63
|
+
It also adapts small, modified pieces of [behave](https://github.com/behave/behave)
|
|
64
|
+
itself (also BSD-2-Clause) — see [Patches](docu/patches.md) for what and why,
|
|
65
|
+
and [`src/patches/BEHAVE_LICENSE.md`](src/patches/BEHAVE_LICENSE.md) for the
|
|
66
|
+
full upstream notice.
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Configuration file for the Sphinx documentation builder.
|
|
2
|
+
#
|
|
3
|
+
# For the full list of built-in configuration values, see the documentation:
|
|
4
|
+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
|
|
5
|
+
|
|
6
|
+
# -- Project information -----------------------------------------------------
|
|
7
|
+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
|
|
8
|
+
|
|
9
|
+
project = 'Behave Cucumber Parser'
|
|
10
|
+
copyright = '2026, Paul Markstädter'
|
|
11
|
+
author = 'Paul Markstädter'
|
|
12
|
+
|
|
13
|
+
# Load version from git tag
|
|
14
|
+
from pathlib import Path
|
|
15
|
+
import versioningit
|
|
16
|
+
release = versioningit.get_version(Path(__file__).parent)
|
|
17
|
+
version = '.'.join(release.split('.')[:2])
|
|
18
|
+
|
|
19
|
+
# -- General configuration ---------------------------------------------------
|
|
20
|
+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
|
|
21
|
+
|
|
22
|
+
extensions = [
|
|
23
|
+
'myst_parser',
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
# Generate heading anchors (e.g. #dependencies-feature) so docu/*.md files
|
|
27
|
+
# can cross-reference each other's sections with plain markdown links.
|
|
28
|
+
myst_heading_anchors = 3
|
|
29
|
+
|
|
30
|
+
source_suffix = {
|
|
31
|
+
'.rst': 'restructuredtext',
|
|
32
|
+
'.txt': 'markdown',
|
|
33
|
+
'.md': 'markdown',
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
# templates_path = ['_templates']
|
|
37
|
+
exclude_patterns = [
|
|
38
|
+
'bin',
|
|
39
|
+
'.*.venv',
|
|
40
|
+
'Thumbs.db',
|
|
41
|
+
'.DS_Store',
|
|
42
|
+
'dependencies',
|
|
43
|
+
]
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
# -- Options for HTML output -------------------------------------------------
|
|
48
|
+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
|
|
49
|
+
|
|
50
|
+
import os
|
|
51
|
+
|
|
52
|
+
html_theme = 'sphinx_book_theme'
|
|
53
|
+
html_static_path = ['_static']
|
|
54
|
+
html_theme_options = {
|
|
55
|
+
"repository_provider": "gitlab",
|
|
56
|
+
"repository_url": os.environ.get("CI_PROJECT_URL",
|
|
57
|
+
"Provided in pipeline by $CI_PROJECT_URL (https://docs.gitlab.com/ci/variables/predefined_variables/)"),
|
|
58
|
+
"use_repository_button": True,
|
|
59
|
+
"use_issues_button": True,
|
|
60
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Python packages needed to build and package the project.
|
|
2
|
+
# Installed via the "build" environment (see ../pyproject.toml optional-dependencies).
|
|
3
|
+
|
|
4
|
+
# Dependencies for packaging
|
|
5
|
+
build >= 1.5.0
|
|
6
|
+
hatchling >= 1.29.0
|
|
7
|
+
versioningit >= 3.3.0
|
|
8
|
+
hatch-requirements-txt >= 0.4.1
|
|
9
|
+
|
|
10
|
+
# Dependencies of build scripts
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# Debian packages needed to generate documentation.
|
|
2
|
+
# Installed via the "docuApt" environment (see ../pyproject.toml optional-dependencies).
|
|
3
|
+
# Only required to build the PDF via Sphinx's LaTeX builder (see
|
|
4
|
+
# ../docu/devEnvironment.md); the HTML build needs no system packages.
|
|
5
|
+
|
|
6
|
+
texlive-full
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Python packages needed to generate documentation.
|
|
2
|
+
# Installed via the "docu" environment (see ../pyproject.toml optional-dependencies).
|
|
3
|
+
|
|
4
|
+
# sphinx
|
|
5
|
+
Sphinx >= 9.1.0
|
|
6
|
+
sphinx-autobuild >= 2025.8.25
|
|
7
|
+
|
|
8
|
+
#utils
|
|
9
|
+
versioningit >= 3.3.0
|
|
10
|
+
|
|
11
|
+
# extensions
|
|
12
|
+
myst-parser >= 5.1.0
|
|
13
|
+
|
|
14
|
+
# Themes
|
|
15
|
+
sphinx-book-theme >= 1.2.0
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Python packages needed to run the project.
|
|
2
|
+
# Always installed with the package (see ../pyproject.toml
|
|
3
|
+
# [tool.hatch.metadata.hooks.requirements_txt]), and also available as
|
|
4
|
+
# the "runtime" environment for local setup.
|
|
5
|
+
|
|
6
|
+
behave >= 1.3.3
|
|
7
|
+
gherkin-official >= 41.0.0
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# Development environment
|
|
2
|
+
|
|
3
|
+
To set up the development environment for this project, follow these steps:
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
- Git and python installed on your local machine
|
|
8
|
+
- A GitLab account with access to this repository
|
|
9
|
+
- A text editor or IDE of your choice
|
|
10
|
+
|
|
11
|
+
## Clone the repository
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
git clone https://gitlab.com/pm-virutallab/workflow/behave-cucumber-parser.git
|
|
15
|
+
cd <repository-directory>
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Set up an environment
|
|
19
|
+
|
|
20
|
+
Each stage of the project (building, running, testing, building the
|
|
21
|
+
documentation, ...) has its own environment, declared in
|
|
22
|
+
[pyproject.toml](../pyproject.toml) under
|
|
23
|
+
`tool.hatch.metadata.hooks.requirements_txt.optional-dependencies`. Every
|
|
24
|
+
environment `<name>` has two entries:
|
|
25
|
+
|
|
26
|
+
- `<name>`: PyPI package dependencies, listed in
|
|
27
|
+
`dependencies/<name>.requirements.txt`
|
|
28
|
+
- `<name>Apt`: Debian package dependencies, listed in
|
|
29
|
+
`dependencies/<name>.apt.requirements`
|
|
30
|
+
|
|
31
|
+
Set up any declared environment with a single command, which installs
|
|
32
|
+
both its Python and Debian dependencies into a dedicated `.<name>.venv`
|
|
33
|
+
virtual environment:
|
|
34
|
+
|
|
35
|
+
```sh
|
|
36
|
+
source ./setup.env.sh <name>
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
For example, to set up the environment used for building the
|
|
40
|
+
documentation:
|
|
41
|
+
|
|
42
|
+
```sh
|
|
43
|
+
source ./setup.env.sh docu
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Debian and Python dependencies can also be installed separately:
|
|
47
|
+
|
|
48
|
+
```sh
|
|
49
|
+
# Install deb packages (requires sudo)
|
|
50
|
+
source ./setup.debian.sh <name>
|
|
51
|
+
# Install pypi packages
|
|
52
|
+
source ./setup.python.sh <name>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Both [setup.debian.sh](../setup.debian.sh) and
|
|
56
|
+
[setup.python.sh](../setup.python.sh) build on top of
|
|
57
|
+
[setup.base.sh](../setup.base.sh), which creates/activates the
|
|
58
|
+
`.<name>.venv` virtual environment and installs the `build` package used
|
|
59
|
+
to discover an environment's dependencies from `pyproject.toml` via
|
|
60
|
+
`python -m build --metadata`.
|
|
61
|
+
|
|
62
|
+
## Build the package
|
|
63
|
+
|
|
64
|
+
```sh
|
|
65
|
+
source ./setup.env.sh build
|
|
66
|
+
python -m build --outdir bin/dist .
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
The wheel and source distribution are written to `bin/dist`.
|
|
70
|
+
|
|
71
|
+
## Run tests
|
|
72
|
+
|
|
73
|
+
```sh
|
|
74
|
+
source ./setup.env.sh test
|
|
75
|
+
cp -f features/test_behave.ini behave.ini
|
|
76
|
+
behave
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
JUnit reports are written to `bin/test/reports`. See
|
|
80
|
+
[Features](features.md) for how feature files, environments and behave
|
|
81
|
+
presets relate to each other.
|
|
82
|
+
|
|
83
|
+
## Generate the documentation
|
|
84
|
+
|
|
85
|
+
```sh
|
|
86
|
+
source ./setup.env.sh docu
|
|
87
|
+
sphinx-build . bin
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Or, to rebuild automatically as files change and serve a live preview:
|
|
91
|
+
|
|
92
|
+
```sh
|
|
93
|
+
sphinx-autobuild . bin
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
The generated HTML is written to `bin`.
|
|
97
|
+
|
|
98
|
+
## Generate the PDF documentation
|
|
99
|
+
|
|
100
|
+
Building the PDF additionally requires a LaTeX distribution, installed
|
|
101
|
+
via the `docuApt` entry of the `docu` environment (see
|
|
102
|
+
[dependencies/docu.apt.requirements](../dependencies/docu.apt.requirements)):
|
|
103
|
+
|
|
104
|
+
```sh
|
|
105
|
+
source ./setup.env.sh docu
|
|
106
|
+
sphinx-build -M latexpdf . bin
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
The generated PDF is written to `bin/latex`.
|
|
110
|
+
|
|
111
|
+
## Create a release
|
|
112
|
+
|
|
113
|
+
The version is derived from the most recent git tag in
|
|
114
|
+
[semantic version format](https://semver.org/) (e.g. `1.0.0`) via
|
|
115
|
+
[versioningit](https://versioningit.readthedocs.io), configured in
|
|
116
|
+
[pyproject.toml](../pyproject.toml) under `tool.hatch.version`. Tagging
|
|
117
|
+
a commit and pushing the tag both cuts the release and triggers it:
|
|
118
|
+
|
|
119
|
+
```sh
|
|
120
|
+
git tag 1.0.0
|
|
121
|
+
git push origin 1.0.0
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Pushing the tag runs the full pipeline (`.gitlab-ci.yml`) against that
|
|
125
|
+
commit, building the package and documentation with that exact version.
|
|
126
|
+
Once every job succeeds, `create-release` publishes a GitLab release
|
|
127
|
+
for the tag with the HTML docs, PDF docs, wheel and sdist attached as
|
|
128
|
+
release assets, in addition to `deploy-python-package` uploading the
|
|
129
|
+
package to the registry as on every pipeline.
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# Features
|
|
2
|
+
|
|
3
|
+
Following features describe the functionality of this project.
|
|
4
|
+
Feature files are written in [Gherkin](https://cucumber.io/docs/gherkin/) syntax.
|
|
5
|
+
[behave](https://behave.readthedocs.io/en/stable/) is used to test the project against the features.
|
|
6
|
+
Therefore the steps are implemented per environment under
|
|
7
|
+
`features/<name>_steps/`, e.g. [test_steps](../features/test_steps/).
|
|
8
|
+
|
|
9
|
+
- [Features](#features)
|
|
10
|
+
- [Feature List](#feature-list)
|
|
11
|
+
- [Presets](#presets)
|
|
12
|
+
- [Tagging](#tagging)
|
|
13
|
+
- [Deprecated](#deprecated)
|
|
14
|
+
- [Environment test](#environment-test)
|
|
15
|
+
- [Not Implemented](#not-implemented)
|
|
16
|
+
- [Manual](#manual)
|
|
17
|
+
- [Work in progress](#work-in-progress)
|
|
18
|
+
|
|
19
|
+
## Feature List
|
|
20
|
+
|
|
21
|
+
% In a plain Markdown preview (GitHub, editors, ...) this is just a fenced
|
|
22
|
+
% code block. Built with Sphinx, it expands into a live, linked table of
|
|
23
|
+
% contents listing every `*.feature.md` file in `features/`.
|
|
24
|
+
|
|
25
|
+
```{toctree}
|
|
26
|
+
:glob:
|
|
27
|
+
../features/*.feature
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Presets
|
|
31
|
+
|
|
32
|
+
Each environment declared in `pyproject.toml` (see
|
|
33
|
+
[Set up an environment](devEnvironment.md#set-up-an-environment)) ships its own behave
|
|
34
|
+
configuration preset, named `features/<name>_behave.ini`. Copy the desired
|
|
35
|
+
environment's preset to the repository's top directory to run `behave` for
|
|
36
|
+
that environment only:
|
|
37
|
+
|
|
38
|
+
```sh
|
|
39
|
+
cp -f features/<name>_behave.ini behave.ini
|
|
40
|
+
behave
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
- [test_behave.ini](../features/test_behave.ini): Runs scenarios tagged `@env:test`.
|
|
44
|
+
|
|
45
|
+
## Tagging
|
|
46
|
+
|
|
47
|
+
The features, rules or scenarios may be tagged, to describe when they have to be executed.
|
|
48
|
+
This sections describes which tags are used and when to use them.
|
|
49
|
+
|
|
50
|
+
### Deprecated
|
|
51
|
+
|
|
52
|
+
The `@deprecated` tag marks parts, which where tested / supported in the past and are not guaranteed to work in future.
|
|
53
|
+
|
|
54
|
+
### Environment test
|
|
55
|
+
|
|
56
|
+
The `@env:test` tag marks parts, which are tested in the `test` environment.
|
|
57
|
+
The apt and pypi packages this environment depends on are described in [pyproject.toml](../pyproject.toml):
|
|
58
|
+
|
|
59
|
+
```toml
|
|
60
|
+
[tool.hatch.metadata.hooks.requirements_txt.optional-dependencies]
|
|
61
|
+
test = ["dependencies/test.requirements.txt"]
|
|
62
|
+
testApt = ["dependencies/test.apt.requirements"]
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Not Implemented
|
|
66
|
+
|
|
67
|
+
The `@not-implemented` tag marks parts which are already described, but not implemented.
|
|
68
|
+
This could be used to write tests, before the implementation of the features.
|
|
69
|
+
|
|
70
|
+
### Manual
|
|
71
|
+
|
|
72
|
+
The `@manual` tag marks parts, which can't be tested automatically at the moment.
|
|
73
|
+
They have more documentation purpose.
|
|
74
|
+
|
|
75
|
+
### Work in progress
|
|
76
|
+
|
|
77
|
+
The `@wip` tag is used to mark sections, the developer is currently implementing or investigating.
|
|
78
|
+
This makes it simpler to test the current work, to get faster results.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Patches
|
|
2
|
+
|
|
3
|
+
This project overrides three pieces of `behave`'s own internals, so that
|
|
4
|
+
`behave` runs feature files through the `gherkin` package's Cucumber parser
|
|
5
|
+
instead of its own, and so it discovers `*.feature.md` files — `behave` only
|
|
6
|
+
looks for `*.feature` files and parses with its own parser by default.
|
|
7
|
+
|
|
8
|
+
| Patch | Overrides | Source |
|
|
9
|
+
| -------------------------------------------------------------------------- | ------------------------------------------------------------------------ | ---------------------------------------- |
|
|
10
|
+
| [`parse_features`](../src/patches/parse_features.md) | `behave.runner_util.parse_features()` / `behave.runner.parse_features()` | Original code, not adapted from `behave` |
|
|
11
|
+
| [`collect_feature_locations`](../src/patches/collect_feature_locations.md) | `behave.runner_util.collect_feature_locations()` | Adapted from `behave` |
|
|
12
|
+
| [`setup_paths`](../src/patches/setup_paths.md) | `behave.runner.Runner.setup_paths()` | Adapted from `behave` |
|
|
13
|
+
|
|
14
|
+
`collect_feature_locations` and `setup_paths` are copied-and-modified
|
|
15
|
+
`behave` source, distributed under `behave`'s BSD-2-Clause license — see
|
|
16
|
+
[`BEHAVE_LICENSE.md`](../src/patches/BEHAVE_LICENSE.md) for the
|
|
17
|
+
full upstream notice.
|
|
18
|
+
|
|
19
|
+
All three are applied at interpreter startup by
|
|
20
|
+
[`pth/behave_cucumber_parser.pth`](../pth/behave_cucumber_parser.pth) via
|
|
21
|
+
[`install.py`](../src/patches/install.md).
|
|
22
|
+
|
|
23
|
+
% In a plain Markdown preview this is just a fenced code block. Built with
|
|
24
|
+
% Sphinx, it expands into a live, linked table of contents listing every
|
|
25
|
+
% `.md` doc in `src/patches/`.
|
|
26
|
+
|
|
27
|
+
```{toctree}
|
|
28
|
+
:glob:
|
|
29
|
+
|
|
30
|
+
../src/patches/*
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
The actual Cucumber-Gherkin-AST-to-`behave`-model conversion that
|
|
34
|
+
`parse_features` calls into lives in `src/adapter/` — also original code,
|
|
35
|
+
not adapted from `behave`.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Updating from template
|
|
2
|
+
|
|
3
|
+
This project is created from a template and can receive updates when the template itself changes.
|
|
4
|
+
This is done by adding the template repository as a Git remote called `template`.
|
|
5
|
+
|
|
6
|
+
## Setup
|
|
7
|
+
|
|
8
|
+
Add the template repository as a remote:
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
git remote add template <template-repo-url>
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Pulling Template Updates
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
git branch template/update
|
|
18
|
+
git switch template/update
|
|
19
|
+
git fetch template
|
|
20
|
+
git merge template/main
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Git will merge only the lines that changed in the template, so customizations like
|
|
24
|
+
replaced placeholders and project-specific content are preserved where there is no conflict.
|
|
25
|
+
|
|
26
|
+
## Resolving Conflicts
|
|
27
|
+
|
|
28
|
+
Conflicts occur where both the template and your project modified the same lines.
|
|
29
|
+
Git will mark the affected files:
|
|
30
|
+
|
|
31
|
+
```diff
|
|
32
|
+
<<<<<<< HEAD
|
|
33
|
+
your project's version
|
|
34
|
+
=======
|
|
35
|
+
template's updated version
|
|
36
|
+
>>>>>>> template/main
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Resolve each conflict by editing the file to the desired result, then commit and push changes.
|
|
40
|
+
|
|
41
|
+
## What to Expect
|
|
42
|
+
|
|
43
|
+
- **Replaced placeholders** (e.g. `<<PROJECT_NAME>>`) are not re-introduced as long as you
|
|
44
|
+
have already replaced them — only changed lines propagate.
|
|
45
|
+
- **Files you deleted** (e.g. removed feature files) will not reappear unless the template
|
|
46
|
+
also modified those files, in which case Git raises a conflict to let you decide.
|
|
47
|
+
- **New files** added to the template are merged in automatically without conflict.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
// Scoped to features/: these files are Markdown with Gherkin
|
|
3
|
+
// (https://github.com/cucumber/gherkin/blob/main/MARKDOWN_WITH_GHERKIN.md),
|
|
4
|
+
// not prose Markdown, so the rules below don't apply and must stay
|
|
5
|
+
// disabled here rather than via inline markdownlint-disable comments —
|
|
6
|
+
// an HTML comment as the first line breaks the Gherkin-in-Markdown parser
|
|
7
|
+
// (it gets consumed as the Feature line instead of the real "# Feature:").
|
|
8
|
+
|
|
9
|
+
// First line in file should be a top-level heading: a leading `@tag` line
|
|
10
|
+
// (e.g. `@env:test`) legitimately precedes "# Feature: ...".
|
|
11
|
+
"MD041": false,
|
|
12
|
+
|
|
13
|
+
// Headings should be surrounded by blank lines: Tags must be directly in
|
|
14
|
+
// line before heading
|
|
15
|
+
"MD022": false,
|
|
16
|
+
|
|
17
|
+
// No trailing punctuation in heading: every Gherkin keyword heading ends
|
|
18
|
+
// in ":" ("# Feature: ...", "## Rule: ...", "### Scenario: ...").
|
|
19
|
+
"MD026": false
|
|
20
|
+
}
|