Skip to content

Report shows wrong attachments for parameterized fixtures #207

@Sup3rGeo

Description

@Sup3rGeo

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: pytest@3.4.0
  • Allure adaptor: allure-pytest@2.3.2b1

Other information

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