-
Notifications
You must be signed in to change notification settings - Fork 242
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
Fixed tests that were failing due Pytest updates #190
Changes from 6 commits
d75a67a
fa09e9b
c320f42
0f2de35
3f28510
c30a995
7d9ded4
319699d
88cd856
1e5eec4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -100,7 +100,7 @@ def __init__(self, logfile, config): | |
|
||
class TestResult: | ||
|
||
def __init__(self, outcome, report, logfile, config): | ||
def __init__(self, outcome, report, logfile, config, test_index=0): | ||
self.test_id = report.nodeid | ||
if getattr(report, 'when', 'call') != 'call': | ||
self.test_id = '::'.join([report.nodeid, report.when]) | ||
|
@@ -113,8 +113,6 @@ def __init__(self, outcome, report, logfile, config): | |
self.config = config | ||
self.row_table = self.row_extra = None | ||
|
||
test_index = hasattr(report, 'rerun') and report.rerun + 1 or 0 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I realised from here that report doesn't have the attribute There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This could be a regression from pytest-rerunfailures. It would seem that the latest version doesn't report the number of reruns in the report? If so, please raise an issue against the plugin. In the meantime we could pin our tests to the version of pytest-rerunfailures before this change. |
||
|
||
for extra_index, extra in enumerate(getattr(report, 'extra', [])): | ||
self.append_extra_html(extra, extra_index, test_index) | ||
|
||
|
@@ -263,7 +261,8 @@ def append_log_html(self, report, additional_html): | |
additional_html.append(log) | ||
|
||
def _appendrow(self, outcome, report): | ||
result = self.TestResult(outcome, report, self.logfile, self.config) | ||
result = self.TestResult(outcome, report, self.logfile, self.config, | ||
self.rerun) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
if result.row_table is not None: | ||
index = bisect.bisect_right(self.results, result) | ||
self.results.insert(index, result) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -140,7 +140,9 @@ def test_xpass(): pass | |
|
||
def test_setup_error(self, testdir): | ||
testdir.makepyfile(""" | ||
def pytest_funcarg__arg(request): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Funcarg is deprecated since Pytest 4. |
||
import pytest | ||
@pytest.fixture | ||
def arg(request): | ||
raise ValueError() | ||
def test_function(arg): | ||
pass | ||
|
@@ -442,7 +444,7 @@ def pytest_runtest_makereport(item, call): | |
""".format(extra_type, content)) | ||
testdir.makepyfile(""" | ||
import pytest | ||
@pytest.mark.flaky(reruns=2) | ||
@pytest.mark.flaky(reruns=4) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just because the loop bellow goes from 1 to 4 (so it checks for extra content 4 times) and there was only 2 reruns. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see your logic, but I wonder why we had this mismatch with tests passing? This code hasn't changed in three years. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I saw the logic there before, actually the loop checks for content 3 times ( |
||
def test_fail(): | ||
assert False""") | ||
result, html = run(testdir) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm using Visual Studio right now, so I added it.