| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 058a6af commit 00591e1
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6,13 +6,29 @@ on: | |||
| 6 | 6 | - master | |
| 7 | 7 | ||
| 8 | 8 | jobs: | |
| 9 | - changes: | ||
| 10 | - name: Collect file changes | ||
| 9 | + pytest-changes: | ||
| 10 | + name: Collect allure-pytest file changes | ||
| 11 | + runs-on: ubuntu-latest | ||
| 12 | + outputs: | ||
| 13 | + changed: ${{ steps.filter.outputs.allure-pytest }} | ||
| 14 | + steps: | ||
| 15 | + - uses: dorny/paths-filter@v3 | ||
| 16 | + id: filter | ||
| 17 | + with: | ||
| 18 | + filters: | | ||
| 19 | + allure-pytest: | ||
| 20 | + - allure-pytest/** | ||
| 21 | + - allure-python-commons/** | ||
| 22 | + - allure-python-commons-test/** | ||
| 23 | + - tests/*.py | ||
| 24 | + - tests/allure_pytest/** | ||
| 25 | + other-changes: | ||
| 26 | + name: Collect file changes other than allure-pytest | ||
| 11 | 27 | runs-on: ubuntu-latest | |
| 12 | 28 | outputs: | |
| 13 | 29 | packages: ${{ steps.filter.outputs.changes }} | |
| 14 | 30 | steps: | |
| 15 | - - uses: dorny/paths-filter@v2 | ||
| 31 | + - uses: dorny/paths-filter@v3 | ||
| 16 | 32 | id: filter | |
| 17 | 33 | with: | |
| 18 | 34 | filters: | | |
@@ -28,12 +44,6 @@ jobs: | |||
| 28 | 44 | - allure-python-commons-test/** | |
| 29 | 45 | - tests/*.py | |
| 30 | 46 | - tests/allure_nose2/** | |
| 31 | - allure-pytest: | ||
| 32 | - - allure-pytest/** | ||
| 33 | - - allure-python-commons/** | ||
| 34 | - - allure-python-commons-test/** | ||
| 35 | - - tests/*.py | ||
| 36 | - - tests/allure_pytest/** | ||
| 37 | 47 | allure-pytest-bdd: | |
| 38 | 48 | - allure-pytest-bdd/** | |
| 39 | 49 | - allure-python-commons/** | |
@@ -53,7 +63,7 @@ jobs: | |||
| 53 | 63 | name: Build commons | |
| 54 | 64 | runs-on: ubuntu-latest | |
| 55 | 65 | steps: | |
| 56 | - - uses: actions/checkout@v3 | ||
| 66 | + - uses: actions/checkout@v4 | ||
| 57 | 67 | ||
| 58 | 68 | - name: Cache commons | |
| 59 | 69 | id: commons | |
@@ -68,13 +78,13 @@ jobs: | |||
| 68 | 78 | python -m build allure-python-commons --outdir dist/ && | |
| 69 | 79 | python -m build allure-python-commons-test --outdir dist/ | |
| 70 | 80 | ||
| 71 | - linters: | ||
| 81 | + lint: | ||
| 72 | 82 | name: Static check | |
| 73 | 83 | runs-on: ubuntu-latest | |
| 74 | - needs: [commons, changes] | ||
| 75 | - if: ${{ needs.changes.outputs.packages != '[]' }} | ||
| 84 | + needs: [commons, pytest-changes, other-changes] | ||
| 85 | + if: ${{ needs.pytest-changes.outputs.changed || needs.other-changes.outputs.packages != '[]' }} | ||
| 76 | 86 | steps: | |
| 77 | - - uses: actions/checkout@v3 | ||
| 87 | + - uses: actions/checkout@v4 | ||
| 78 | 88 | ||
| 79 | 89 | - name: Set up Python | |
| 80 | 90 | uses: actions/setup-python@v4 | |
@@ -87,23 +97,67 @@ jobs: | |||
| 87 | 97 | - name: Linting the codebase | |
| 88 | 98 | run: poe linter | |
| 89 | 99 | ||
| 90 | - build: | ||
| 91 | - name: Test package | ||
| 100 | + test-pytest: | ||
| 101 | + name: Test allure-pytest | ||
| 92 | 102 | runs-on: ubuntu-latest | |
| 93 | - needs: [linters, commons, changes] | ||
| 94 | - if: ${{ needs.changes.outputs.packages != '[]' }} | ||
| 103 | + needs: [commons, pytest-changes] | ||
| 104 | + if: ${{ needs.pytest-changes.outputs.changed }} | ||
| 95 | 105 | strategy: | |
| 96 | 106 | matrix: | |
| 97 | - package: ${{ fromJSON(needs.changes.outputs.packages) }} | ||
| 98 | 107 | python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] | |
| 108 | + pytest-version: ["7.*", "8.*"] | ||
| 109 | + exclude: | ||
| 110 | + - python-version: "3.7" | ||
| 111 | + pytest-version: "8.*" | ||
| 99 | 112 | env: | |
| 100 | 113 | TEST_TMP: /tmp | |
| 101 | 114 | ALLURE_INDENT_OUTPUT: yep | |
| 102 | 115 | steps: | |
| 103 | - - uses: actions/checkout@v3 | ||
| 116 | + - uses: actions/checkout@v4 | ||
| 104 | 117 | ||
| 105 | 118 | - name: Set up Python ${{ matrix.python-version }} | |
| 106 | - uses: actions/setup-python@v4 | ||
| 119 | + uses: actions/setup-python@v5 | ||
| 120 | + with: | ||
| 121 | + python-version: ${{ matrix.python-version }} | ||
| 122 | + | ||
| 123 | + - name: Get commons from cache | ||
| 124 | + id: commons | ||
| 125 | + uses: actions/cache@v3 | ||
| 126 | + with: | ||
| 127 | + path: dist/ | ||
| 128 | + key: commons-${{ github.sha }} | ||
| 129 | + | ||
| 130 | + - name: Install packages | ||
| 131 | + run: | | ||
| 132 | + pip install dist/allure-python-commons*.tar.gz \ | ||
| 133 | + ./allure-pytest \ | ||
| 134 | + pytest==${{ matrix.pytest-version }} \ | ||
| 135 | + -r ./requirements/testing.txt \ | ||
| 136 | + -r ./requirements/testing/allure-pytest.txt | ||
| 137 | + | ||
| 138 | + - name: Test allure-pytest | ||
| 139 | + working-directory: allure-pytest | ||
| 140 | + run: poe tests | ||
| 141 | + | ||
| 142 | + test-others: | ||
| 143 | + name: Test packages other than allure-pytest | ||
| 144 | + runs-on: ubuntu-latest | ||
| 145 | + needs: [commons, other-changes] | ||
| 146 | + if: ${{ needs.other-changes.outputs.packages != '[]' }} | ||
| 147 | + strategy: | ||
| 148 | + matrix: | ||
| 149 | + package: ${{ fromJSON(needs.other-changes.outputs.packages) }} | ||
| 150 | + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] | ||
| 151 | + exclude: | ||
| 152 | + - package: allure-pytest | ||
| 153 | + env: | ||
| 154 | + TEST_TMP: /tmp | ||
| 155 | + ALLURE_INDENT_OUTPUT: yep | ||
| 156 | + steps: | ||
| 157 | + - uses: actions/checkout@v4 | ||
| 158 | + | ||
| 159 | + - name: Set up Python ${{ matrix.python-version }} | ||
| 160 | + uses: actions/setup-python@v5 | ||
| 107 | 161 | with: | |
| 108 | 162 | python-version: ${{ matrix.python-version }} | |
| 109 | 163 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,7 @@ | |||
| 1 | 1 | import pytest | |
| 2 | 2 | import doctest | |
| 3 | + from packaging import version | ||
| 4 | + | ||
| 3 | 5 | import allure_commons | |
| 4 | 6 | from allure_commons.utils import now | |
| 5 | 7 | from allure_commons.utils import uuid4 | |
@@ -347,13 +349,23 @@ def _test_fixtures(item): | |||
| 347 | 349 | ||
| 348 | 350 | if hasattr(item, "_request") and hasattr(item._request, "fixturenames"): | |
| 349 | 351 | for name in item._request.fixturenames: | |
| 350 | - fixturedefs_pytest = fixturemanager.getfixturedefs(name, item.nodeid) | ||
| 352 | + fixturedefs_pytest = _getfixturedefs(fixturemanager, name, item) | ||
| 351 | 353 | if fixturedefs_pytest: | |
| 352 | 354 | fixturedefs.extend(fixturedefs_pytest) | |
| 353 | 355 | ||
| 354 | 356 | return fixturedefs | |
| 355 | 357 | ||
| 356 | 358 | ||
| 359 | + def _getfixturedefs(fixturemanager, name, item): | ||
| 360 | + # See pytest-dev/pytest#11785 | ||
| 361 | + itemarg = item if __is_pytest8_1_or_greater() else item.nodeid | ||
| 362 | + return fixturemanager.getfixturedefs(name, itemarg) | ||
| 363 | + | ||
| 364 | + | ||
| 365 | + def __is_pytest8_1_or_greater(): | ||
| 366 | + return version.parse(pytest.__version__) >= version.parse("8.1") | ||
| 367 | + | ||
| 368 | + | ||
| 357 | 369 | def _exception_brokes_test(exception): | |
| 358 | 370 | return not isinstance(exception, ( | |
| 359 | 371 | AssertionError, | |
| Back | FazBrowse Home | New Git URL |
0 commit comments