Skip to content

Fixes issue related to rerun attribute on report (Issue #77) #78

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jan 8, 2019

Conversation

RibeiroAna
Copy link
Member

As I reported on #77

Copy link
Member

@sallner sallner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the finding the regression and the respective solution and adding a changelog entry. I am afraid, with the current PR , we are not fixing the regression completely as 10a9df2 changed the value of i by one. Could you please take that into account?

@@ -175,6 +175,7 @@ def pytest_runtest_protocol(item, nextitem):
reports = runtestprotocol(item, nextitem=nextitem, log=False)

for report in reports: # 3 reports: setup, call, teardown
report.rerun = item.execution_count
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To restore the old behaviour, I think we need to subtract from the execution_count.

Suggested change
report.rerun = item.execution_count
report.rerun = item.execution_count -1

testdir.makeconftest("""
def pytest_runtest_logreport(report):
assert hasattr(report, 'rerun')
assert isinstance(report.rerun, int)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we could assert the upper limit for reruns here.

Suggested change
assert isinstance(report.rerun, int)
assert isinstance(report.rerun, int)
assert report.rerun <= 2

@sallner sallner merged commit fb9dc72 into pytest-dev:master Jan 8, 2019
@sallner
Copy link
Member

sallner commented Jan 8, 2019

Thanks again for you contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants