-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Fix type errors after adding types to the py
dependency
#6511
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
Changes from all commits
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 |
---|---|---|
|
@@ -462,6 +462,7 @@ def reportinfo(self) -> Tuple[Union[py.path.local, str], Optional[int], str]: | |
@cached_property | ||
def location(self) -> Tuple[str, Optional[int], str]: | ||
location = self.reportinfo() | ||
assert isinstance(location[0], py.path.local), location[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. You've removed the change from reportinfo, right? (from the initial Git tree) 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. Yes. |
||
fspath = self.session._node_location_to_relpath(location[0]) | ||
assert type(location[2]) is str | ||
return (fspath, location[1], location[2]) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1018,18 +1018,18 @@ class TestReportInfo: | |
def test_itemreport_reportinfo(self, testdir): | ||
testdir.makeconftest( | ||
""" | ||
import pytest | ||
import pytest, py | ||
class MyFunction(pytest.Function): | ||
def reportinfo(self): | ||
return "ABCDE", 42, "custom" | ||
return py.path.local("foo"), 42, "custom" | ||
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. That's kind of an API change - I've noticed this myself that the tests seem to be the only things using 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. The Only this test trigerred the assert, and it's just a mock, so I think it should be fine. |
||
def pytest_pycollect_makeitem(collector, name, obj): | ||
if name == "test_func": | ||
return MyFunction(name, parent=collector) | ||
""" | ||
) | ||
item = testdir.getitem("def test_func(): pass") | ||
item.config.pluginmanager.getplugin("runner") | ||
assert item.location == ("ABCDE", 42, "custom") | ||
assert item.location == ("foo", 42, "custom") | ||
|
||
def test_func_reportinfo(self, testdir): | ||
item = testdir.getitem("def test_func(): pass") | ||
|
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.
Use the error code here? (see
--show-error-codes
, could be added to the config probably) (with flake-ignore then)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.
We should probably do them all at once, maybe on the next mypy bump.