Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: allure-framework/allure-python
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 2.13.5
Choose a base ref
...
head repository: allure-framework/allure-python
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
  • 11 commits
  • 60 files changed
  • 6 contributors

Commits on Apr 18, 2024

  1. Fix cache issue with the build workflow (#810)

    delatrie authored Apr 18, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    cdae0ba View commit details

Commits on May 23, 2024

  1. fix: clean-alluredir FileNotFoundError when run test with xdist (#809)

    hokor authored May 23, 2024
    Copy the full SHA
    20ba28a View commit details

Commits on Feb 17, 2025

  1. chore(ci): update python versions to test against (#842)

    delatrie authored Feb 17, 2025
    Copy the full SHA
    d2499a2 View commit details
  2. fix SVG mime type (#841)

    harmin-parra authored Feb 17, 2025
    Copy the full SHA
    4198940 View commit details

Commits on Mar 26, 2025

  1. feat(pytest-bdd): Allure API implementation (fixes #726, via #845)

    delatrie authored Mar 26, 2025
    Copy the full SHA
    1ceb156 View commit details
  2. Added dynamic severity example (#758)

    suhaibasaeed authored Mar 26, 2025
    Copy the full SHA
    8063899 View commit details

Commits on Mar 27, 2025

  1. Add typehints for step func returning types (#830)

    Co-authored-by: starod00m <nikita@fedsosov.net>
    starod00m and starod00m authored Mar 27, 2025
    Copy the full SHA
    d5a7a20 View commit details
  2. chore(commons): tiny fixes of step type checking (#846)

    delatrie authored Mar 27, 2025
    Copy the full SHA
    e9003d0 View commit details

Commits on Apr 1, 2025

  1. deps(pytest-bdd): require pytest-bdd>=5.0.0 (via #849)

    delatrie authored Apr 1, 2025
    Copy the full SHA
    4c34305 View commit details

Commits on Apr 2, 2025

  1. feat(commons): enable typecheck for Allure API (#850)

    delatrie authored Apr 2, 2025
    Copy the full SHA
    3ea25a2 View commit details

Commits on Apr 3, 2025

  1. fix(pytest-bdd): compatibility with pytest-bdd 5 and 6 (#851)

    delatrie authored Apr 3, 2025
    Copy the full SHA
    04a9655 View commit details
Showing with 6,613 additions and 190 deletions.
  1. +1 −2 .flake8
  2. +26 −52 .github/workflows/build.yaml
  3. +1 −2 allure-behave/setup.py
  4. +1 −1 allure-nose2/setup.py
  5. +3 −2 allure-pytest-bdd/setup.py
  6. +119 −0 allure-pytest-bdd/src/allure_api_listener.py
  7. +48 −2 allure-pytest-bdd/src/plugin.py
  8. +71 −61 allure-pytest-bdd/src/pytest_bdd_listener.py
  9. +205 −0 allure-pytest-bdd/src/steps.py
  10. +42 −0 allure-pytest-bdd/src/storage.py
  11. +293 −23 allure-pytest-bdd/src/utils.py
  12. +10 −0 allure-pytest/examples/label/severity/dynamic_severity.rst
  13. +1 −2 allure-pytest/setup.py
  14. +1 −1 allure-python-commons-test/setup.py
  15. +8 −0 allure-python-commons-test/src/label.py
  16. +28 −11 allure-python-commons-test/src/result.py
  17. +1 −1 allure-python-commons/pyproject.toml
  18. +23 −20 allure-python-commons/setup.py
  19. +1 −1 allure-python-commons/{allure.py → src/allure/__init__.py}
  20. 0 allure-python-commons/src/allure/py.typed
  21. 0 allure-python-commons/src/{ → allure_commons}/__init__.py
  22. +13 −3 allure-python-commons/src/{ → allure_commons}/_allure.py
  23. 0 allure-python-commons/src/{ → allure_commons}/_core.py
  24. 0 allure-python-commons/src/{ → allure_commons}/_hooks.py
  25. 0 allure-python-commons/src/{ → allure_commons}/lifecycle.py
  26. +1 −1 allure-python-commons/src/{ → allure_commons}/logger.py
  27. 0 allure-python-commons/src/{ → allure_commons}/mapping.py
  28. +3 −3 allure-python-commons/src/{ → allure_commons}/model2.py
  29. 0 allure-python-commons/src/allure_commons/py.typed
  30. 0 allure-python-commons/src/{ → allure_commons}/reporter.py
  31. +1 −1 allure-python-commons/src/{ → allure_commons}/types.py
  32. 0 allure-python-commons/src/{ → allure_commons}/utils.py
  33. +1 −1 allure-robotframework/setup.py
  34. +1 −0 requirements/testing.txt
  35. +533 −0 tests/allure_pytest_bdd/acceptance/attachments_test.py
  36. +395 −0 tests/allure_pytest_bdd/acceptance/description_test.py
  37. 0 tests/allure_pytest_bdd/acceptance/labels/__init__.py
  38. +81 −0 tests/allure_pytest_bdd/acceptance/labels/epics_test.py
  39. +89 −0 tests/allure_pytest_bdd/acceptance/labels/features_test.py
  40. +81 −0 tests/allure_pytest_bdd/acceptance/labels/ids_test.py
  41. +184 −0 tests/allure_pytest_bdd/acceptance/labels/labels_test.py
  42. +81 −0 tests/allure_pytest_bdd/acceptance/labels/manuals_test.py
  43. +81 −0 tests/allure_pytest_bdd/acceptance/labels/parent_suites_test.py
  44. +86 −0 tests/allure_pytest_bdd/acceptance/labels/severities_test.py
  45. +81 −0 tests/allure_pytest_bdd/acceptance/labels/stories_test.py
  46. +81 −0 tests/allure_pytest_bdd/acceptance/labels/sub_suites_test.py
  47. +81 −0 tests/allure_pytest_bdd/acceptance/labels/suites_test.py
  48. +396 −0 tests/allure_pytest_bdd/acceptance/labels/tags_test.py
  49. 0 tests/allure_pytest_bdd/acceptance/links/__init__.py
  50. +268 −0 tests/allure_pytest_bdd/acceptance/links/default_links_test.py
  51. +156 −0 tests/allure_pytest_bdd/acceptance/links/issue_links_test.py
  52. +216 −0 tests/allure_pytest_bdd/acceptance/links/link_templates_test.py
  53. +156 −0 tests/allure_pytest_bdd/acceptance/links/tms_links_test.py
  54. +766 −0 tests/allure_pytest_bdd/acceptance/outcomes_test.py
  55. +415 −0 tests/allure_pytest_bdd/acceptance/parameters_test.py
  56. 0 tests/allure_pytest_bdd/acceptance/steps/__init__.py
  57. +380 −0 tests/allure_pytest_bdd/acceptance/steps/api_steps_test.py
  58. +529 −0 tests/allure_pytest_bdd/acceptance/steps/gherkin_steps_test.py
  59. +540 −0 tests/allure_pytest_bdd/acceptance/title_test.py
  60. +34 −0 tests/e2e.py
3 changes: 1 addition & 2 deletions .flake8
Original file line number Diff line number Diff line change
@@ -6,6 +6,5 @@ exclude =
./tests/allure_behave/acceptance/**/test-data/**
./tests/allure_behave/acceptance/behave_support/background/background_steps.py
per-file-ignores =
./allure-python-commons/src/model2.py:A003
./allure-python-commons/src/types.py:A005
./allure-python-commons/src/allure_commons/types.py:A005
./allure-robotframework/src/listener/types.py:A005
78 changes: 26 additions & 52 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -22,6 +22,7 @@ jobs:
- allure-python-commons-test/**
- tests/*.py
- tests/allure_pytest/**
- .github/workflows/build.yaml
other-changes:
name: Collect file changes other than allure-pytest
runs-on: ubuntu-latest
@@ -38,60 +39,47 @@ jobs:
- allure-python-commons-test/**
- tests/*.py
- tests/allure_behave/**
- .github/workflows/build.yaml
allure-nose2:
- allure-nose2/**
- allure-python-commons/**
- allure-python-commons-test/**
- tests/*.py
- tests/allure_nose2/**
- .github/workflows/build.yaml
allure-pytest-bdd:
- allure-pytest-bdd/**
- allure-python-commons/**
- allure-python-commons-test/**
- tests/*.py
- tests/allure_pytest_bdd/**
- .github/workflows/build.yaml
allure-robotframework:
- allure-robotframework/**
- allure-python-commons/**
- allure-python-commons-test/**
- tests/*.py
- tests/allure_robotframework/**
allure-python-commons: allure-python-commons/**
allure-python-commons-test: allure-python-commons-test/**
commons:
name: Build commons
runs-on: ubuntu-latest
needs: [pytest-changes, other-changes]
if: ${{ needs.pytest-changes.outputs.changed == 'true' || needs.other-changes.outputs.packages != '[]' }}
steps:
- uses: actions/checkout@v4

- name: Cache commons
id: commons
uses: actions/cache@v4
with:
path: dist/
key: commons-${{ github.sha }}

- name: Build python commons
if: steps.commons.outputs.cache-hit != 'true'
run: pip install build &&
python -m build allure-python-commons --outdir dist/ &&
python -m build allure-python-commons-test --outdir dist/
- .github/workflows/build.yaml
allure-python-commons:
- allure-python-commons/**
- .github/workflows/build.yaml
allure-python-commons-test:
- allure-python-commons-test/**
- .github/workflows/build.yaml
lint:
name: Static check
runs-on: ubuntu-latest
needs: [commons, pytest-changes, other-changes]
needs: [pytest-changes, other-changes]
if: ${{ needs.pytest-changes.outputs.changed == 'true' || needs.other-changes.outputs.packages != '[]' }}
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
python-version: "3.13"

- name: Install linting packages
run: pip install -r ./requirements/linting.txt
@@ -102,15 +90,12 @@ jobs:
test-pytest:
name: Test allure-pytest
runs-on: ubuntu-latest
needs: [commons, pytest-changes]
needs: [pytest-changes]
if: ${{ needs.pytest-changes.outputs.changed == 'true' }}
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
pytest-version: ["7.*", "8.*"]
exclude:
- python-version: "3.7"
pytest-version: "8.*"
env:
TEST_TMP: /tmp
ALLURE_INDENT_OUTPUT: yep
@@ -122,16 +107,10 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Get commons from cache
id: commons
uses: actions/cache@v4
with:
path: dist/
key: commons-${{ github.sha }}

- name: Install packages
run: |
pip install dist/allure-python-commons*.tar.gz \
pip install ./allure-python-commons \
./allure-python-commons-test \
./allure-pytest \
pytest==${{ matrix.pytest-version }} \
-r ./requirements/testing.txt \
@@ -142,14 +121,14 @@ jobs:
run: poe tests

test-others:
name: Test packages other than allure-pytest
name: Test other packages
runs-on: ubuntu-latest
needs: [commons, other-changes]
needs: [other-changes]
if: ${{ needs.other-changes.outputs.packages != '[]' }}
strategy:
matrix:
package: ${{ fromJSON(needs.other-changes.outputs.packages) }}
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
exclude:
- package: allure-pytest
env:
@@ -163,18 +142,13 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Get commons from cache
id: commons
uses: actions/cache@v4
with:
path: dist/
key: commons-${{ github.sha }}

- name: Install packages
run: pip install dist/allure-python-commons*.tar.gz &&
pip install ./${{ matrix.package }} &&
pip install -r ./requirements/testing.txt &&
pip install -r ./requirements/testing/${{ matrix.package }}.txt
run: |
pip install ./allure-python-commons \
./allure-python-commons-test \
./${{ matrix.package }} \
-r ./requirements/testing.txt \
-r ./requirements/testing/${{ matrix.package }}.txt
- name: Test ${{ matrix.package }}
working-directory: ${{ matrix.package }}
3 changes: 1 addition & 2 deletions allure-behave/setup.py
Original file line number Diff line number Diff line change
@@ -12,12 +12,12 @@
'Topic :: Software Development :: Testing :: BDD',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3 :: Only',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: 3.13',
]

setup_requires = [
@@ -66,4 +66,3 @@ def main():

if __name__ == '__main__':
main()

2 changes: 1 addition & 1 deletion allure-nose2/setup.py
Original file line number Diff line number Diff line change
@@ -11,12 +11,12 @@
'Topic :: Software Development :: Testing',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3 :: Only',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: 3.13',
]

setup_requires = [
5 changes: 3 additions & 2 deletions allure-pytest-bdd/setup.py
Original file line number Diff line number Diff line change
@@ -10,14 +10,15 @@
'License :: OSI Approved :: Apache Software License',
'Topic :: Software Development :: Quality Assurance',
'Topic :: Software Development :: Testing',
'Topic :: Software Development :: Testing :: BDD',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3 :: Only',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: 3.13',
]

setup_requires = [
@@ -26,7 +27,7 @@

install_requires = [
"pytest>=4.5.0",
"pytest-bdd>=3.0.0"
"pytest-bdd>=5.0.0"
]


119 changes: 119 additions & 0 deletions allure-pytest-bdd/src/allure_api_listener.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
import pytest

import allure_commons

from allure_commons.model2 import Label
from allure_commons.model2 import Link
from allure_commons.model2 import Parameter
from allure_commons.utils import represent

from .utils import ALLURE_DESCRIPTION_HTML_MARK
from .utils import ALLURE_DESCRIPTION_MARK
from .utils import ALLURE_LABEL_MARK
from .utils import ALLURE_LINK_MARK
from .utils import ALLURE_TITLE_ATTR

from .utils import apply_link_pattern
from .utils import attach_data
from .utils import attach_file
from .utils import get_link_patterns
from .steps import start_step
from .steps import stop_step


class AllurePytestBddApiHooks:
def __init__(self, config, lifecycle):
self.lifecycle = lifecycle
self.__link_patterns = get_link_patterns(config)

@allure_commons.hookimpl
def decorate_as_title(self, test_title):

def decorator(fn):
setattr(fn, ALLURE_TITLE_ATTR, test_title)
return fn

return decorator

@allure_commons.hookimpl
def add_title(self, test_title):
with self.lifecycle.update_test_case() as test_result:
test_result.name = test_title

@allure_commons.hookimpl
def decorate_as_description(self, test_description):
allure_description_mark = getattr(pytest.mark, ALLURE_DESCRIPTION_MARK)
return allure_description_mark(test_description)

@allure_commons.hookimpl
def add_description(self, test_description):
with self.lifecycle.update_test_case() as test_result:
test_result.description = test_description

@allure_commons.hookimpl
def decorate_as_description_html(self, test_description_html):
allure_description_html_mark = getattr(pytest.mark, ALLURE_DESCRIPTION_HTML_MARK)
return allure_description_html_mark(test_description_html)

@allure_commons.hookimpl
def add_description_html(self, test_description_html):
with self.lifecycle.update_test_case() as test_result:
test_result.descriptionHtml = test_description_html

@allure_commons.hookimpl
def decorate_as_label(self, label_type, labels):
allure_label_mark = getattr(pytest.mark, ALLURE_LABEL_MARK)
return allure_label_mark(*labels, label_type=label_type)

@allure_commons.hookimpl
def add_label(self, label_type, labels):
with self.lifecycle.update_test_case() as test_result:
test_result.labels.extend(
Label(name=label_type, value=value) for value in labels or []
)

@allure_commons.hookimpl
def decorate_as_link(self, url, link_type, name):
url = apply_link_pattern(self.__link_patterns, link_type, url)
allure_link_mark = getattr(pytest.mark, ALLURE_LINK_MARK)
return allure_link_mark(url, name=name, link_type=link_type)

@allure_commons.hookimpl
def add_link(self, url, link_type, name):
url = apply_link_pattern(self.__link_patterns, link_type, url)
with self.lifecycle.update_test_case() as test_result:
test_result.links.append(Link(url=url, name=name, type=link_type))

@allure_commons.hookimpl
def add_parameter(self, name, value, excluded, mode):
with self.lifecycle.update_test_case() as test_result:
test_result.parameters.append(
Parameter(
name=name,
value=represent(value),
excluded=excluded,
mode=mode.value if mode else None,
),
)

@allure_commons.hookimpl
def start_step(self, uuid, title, params):
start_step(self.lifecycle, step_uuid=uuid, title=title, params=params)

@allure_commons.hookimpl
def stop_step(self, uuid, exc_type, exc_val, exc_tb):
stop_step(
self.lifecycle,
uuid,
exception=exc_val,
exception_type=exc_type,
traceback=exc_tb,
)

@allure_commons.hookimpl
def attach_data(self, body, name, attachment_type, extension):
attach_data(self.lifecycle, body, name, attachment_type, extension)

@allure_commons.hookimpl
def attach_file(self, source, name, attachment_type, extension):
attach_file(self.lifecycle, source, name, attachment_type, extension)
Loading