Title: [allure-behave] Steps from tag-excluded scenarios bleed into the next matching scenario's result when hide_excluded=true · Issue #902 · allure-framework/allure-python · GitHub
Open Graph Title: [allure-behave] Steps from tag-excluded scenarios bleed into the next matching scenario's result when hide_excluded=true · Issue #902 · allure-framework/allure-python
X Title: [allure-behave] Steps from tag-excluded scenarios bleed into the next matching scenario's result when hide_excluded=true · Issue #902 · allure-framework/allure-python
Description: Allure integrations for Python test frameworks. Contribute to allure-framework/allure-python development by creating an account on GitHub.
Open Graph Description: Allure integrations for Python test frameworks. Contribute to allure-framework/allure-python development by creating an account on GitHub.
X Description: Allure integrations for Python test frameworks. Contribute to allure-framework/allure-python development by creating an account on GitHub.
Opengraph URL: https://github.com/allure-framework/allure-python
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[allure-behave] Steps from tag-excluded scenarios bleed into the next matching scenario's result when hide_excluded=true","articleBody":"## Environment\n - allure-behave: 2.15.3\n - allure-commons: (run `pip show allure-commons`)\n - behave: 1.3.3\n - Python: 3.12\n\n ## Describe the Bug\n\n When running behave with a tag filter (e.g. `-t ETS-TC-372`) and\n `-D AllureFormatter.hide_excluded=true`, the Allure result JSON for the\n **matching scenario** accumulates steps from all tag-excluded scenarios that\n appeared before it in the same feature file.\n\n For example: if Sample.feature has 12 scenarios before ETS-TC-372, and\n those 12 scenarios collectively have 179 steps, the result JSON for ETS-TC-372\n shows 227 steps (179 orphaned + 48 real) instead of 48.\n\n ## Root Cause\n\n Behave calls `formatter.step(step)` for **every** scenario — including\n tag-excluded ones — because `show_skipped=True` by default\n (`run_scenario or show_skipped` in `Scenario.run()`).\n\n This schedules excluded scenario steps into `AllureListener.self.steps` (a\n `deque`).\n\n In `stop_scenario()`, excluded scenarios hit the `should_drop_excluded=True`\n branch and call `self.logger.drop_test(uuid)` immediately, **without ever\n calling `flush_steps()` or clearing the deque**. All accumulated steps remain\n in the deque.\n\n When the first *matching* scenario runs, its steps are appended to the\n already-populated deque. `match_step()` pops from the front (FIFO), consuming\n the orphaned steps and stamping them into the matching scenario's `TestResult`.\n\n ## Reproduction Steps\n\n 1. Create a feature file with 5+ scenarios where only the last one has\n `@target-tag`.\n 2. Run:\n ```bash\n behave -t target-tag my.feature \\\n --format allure_behave.formatter:AllureFormatter \\\n --outfile allure-results \\\n -D AllureFormatter.hide_excluded=true\n 3. Inspect allure-results/*-result.json — the step count will be\n (sum of all excluded scenario steps) + (target scenario steps). \n\n Expected Behaviour \n \n The result JSON for the matching scenario should contain only its own \n steps. \n \n Fix\n \n In AllureListener.stop_scenario(), clear the deque before dropping the\n test so orphaned steps do not leak into the next scenario:\n \n # listener.py — stop_scenario()\n if should_drop_skipped_by_option or should_drop_excluded: \n self.steps.clear() # ← add this line \n self.logger.drop_test(self.current_scenario_uuid)\n \n This one-line fix prevents accumulated steps from tag-excluded scenarios \n bleeding into any subsequent scenario's result.","author":{"url":"https://github.com/mahanth967","@type":"Person","name":"mahanth967"},"datePublished":"2026-04-10T17:54:42Z","url":"https://github.com/allure-framework/allure-python/issues/902"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /:user_id/:repository/issues/:id(.:format) |
| route-controller | issues |
| route-action | show |
| fetch-nonce | v2:889104e4-041b-74f6-963d-4df644860d9b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B2A6:9905:98767:D745A:6AFD4A5F |
| html-safe-nonce | 4eac4161b6955d8e794db27c55c0024d8079ed52b1c801056fae487ec15d19d4 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMkE2Ojk5MDU6OTg3Njc6RDc0NUE6NkFGRDRBNUYiLCJ2aXNpdG9yX2lkIjoiNTU1NjE5NDg1OTU2MTA3NzM0MyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 82f3b4289ed7e36e5162df5b3701edd34dd44ecc50ed4f6636b9c990e1e96659 |
| hovercard-subject-tag | repository:79346720 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/allure-framework/allure-python/issues/902 |
| twitter:image | https://opengraph.githubassets.com/4fb4b7c65d2d1acf41a85aa1b1fb010246e6d236295417a7fb848060dd033574/allure-framework/allure-python |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/4fb4b7c65d2d1acf41a85aa1b1fb010246e6d236295417a7fb848060dd033574/allure-framework/allure-python |
| og:image:alt | Allure integrations for Python test frameworks. Contribute to allure-framework/allure-python development by creating an account on GitHub. |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 66653c2e55a6fff2930be1bdf07ee4f8aa137e3956d056c822563be6f878755e |
| turbo-cache-control | no-cache |
| go-import | github.com/allure-framework/allure-python git https://github.com/allure-framework/allure-python.git |
| octolytics-dimension-user_id | 5879127 |
| octolytics-dimension-user_login | allure-framework |
| octolytics-dimension-repository_id | 79346720 |
| octolytics-dimension-repository_nwo | allure-framework/allure-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 79346720 |
| octolytics-dimension-repository_network_root_nwo | allure-framework/allure-python |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | b6f01f7cb9f35f8c09949773241a3d49dd04b340 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width