GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Report shows wrong attachments for parameterized fixtures · Issue #207 · allure-framework/allure-python

Report shows wrong attachments for parameterized fixtures #207

New issue
Copy link
New issue
Copy link
Closed
Closed
Report shows wrong attachments for parameterized fixtures#207
Copy link

Description

@Sup3rGeo
Sup3rGeo
opened on Feb 12, 2018
Issue body actions

I'm submitting a ...

  • bug report

What is the current behavior?

Report shows wrong attachments for parameterized fixtures

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem

Simple test to run as an example of the bug:

import allure
import pytest
import time

@pytest.fixture(scope="module", params=["a","b","c","d","e","f"])
def letter(request):
    timestamp = time.ctime()
    allure.attach(str(timestamp), "Log", attachment_type=allure.attachment_type.TEXT)
    print(timestamp)
    return request.param

def test_letter(letter):
    time.sleep(1)
    assert True

On pytest output you can see three different timestamps with one sec difference from each other, like:

'a': Mon Feb 12 17:40:07 2018
'b' :Mon Feb 12 17:40:08 2018
'c': Mon Feb 12 17:40:09 2018
'd': Mon Feb 12 17:40:10 2018
'e': Mon Feb 12 17:40:11 2018
'f': Mon Feb 12 17:40:12 2018

But on the Logs, you can see it prints on set up, for each of the tests:

'a': Mon Feb 12 17:40:07 2018
'b' :Mon Feb 12 17:40:07 2018
'c': Mon Feb 12 17:40:08 2018
'd': Mon Feb 12 17:40:09 2018
'e': Mon Feb 12 17:40:10 2018
'f': Mon Feb 12 17:40:11 2018

So it repeats the setup attachment for letter 'b' and then keep with the sequence (therefore of course attachments are wrong on all tests).

What is the expected behavior?

Attachments should belong to the fixture instance it belongs to.

Please tell us about your environment:

  • Allure version: 2.5.0
  • Test framework: [email protected]
  • Allure adaptor: [email protected]

Other information

Reacted by Stanislav Seliverstov

Activity

  1. Sup3rGeo commented on Apr 3, 2018

    @Sup3rGeo
    Sup3rGeo
    on Apr 3, 2018
    ContributorAuthor
    More actions

    I got time to debug this a bit, and the problem seems to be that the pytest_fixture_post_finalizer hook, where the fixture is popped from self._cache, runs after the pytest_runtest_protocol for the next test (where the children for containers are defined) - so it still sees the last test's fixture inside the cache.

    More precisely, the fixtures are finalized right before the fixture_setup for the next test.

  2. sseliverstov
    closed this as completedin 0d28836on May 21, 2018
  3. beckerGil
    added a commit that references this issue on Apr 10, 2023

    Wrong attachments for parameterized (fixes allure-framework#207 fixes a…

    This issue will close once commit 88c32fd is merged into the 'master' branch.
    88c32fd
  4. IvanBuruyane
    added 2 commits that reference this issue on Mar 19, 2024

    Wrong attachments for parameterized (fixes allure-framework#207 fixes a…

    This issue will close once commit b7607f1 is merged into the 'master' branch.
    b7607f1

    Wrong attachments for parameterized (fixes allure-framework#207 fixes a…

    This issue will close once commit 0d28836 is merged into the 'master' branch.
    0d28836
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.