-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
config: typing for create_terminal_writer, re-export TerminalWriter #6545
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
Conversation
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.
LGTM except the unrelated bit.
e5252ae
to
197ce3c
Compare
I wonder if I should import it via |
Importing from |
197ce3c
to
74d237c
Compare
Moved it there. Not sure if it should use |
Mypy has a convention (a bit more than a convention actually, given the from py.io import TerminalWriter as TerminalWriter I don't know how flake8 would like it, but I'd do it like this with a comment explaining anyway: # Reexport TerminalWriter from here instead of py, to make it easier to
# extend or swap our own implementation in the future.
from py.io import TerminalWriter as TerminalWriter # noqa: F<something> |
74d237c
to
39e01f5
Compare
Thanks, amended: diff --git c/src/_pytest/_io/__init__.py i/src/_pytest/_io/__init__.py
index 6265353d8..047bb179a 100644
--- c/src/_pytest/_io/__init__.py
+++ i/src/_pytest/_io/__init__.py
@@ -1 +1,3 @@
-from py.io import TerminalWriter
+# Reexport TerminalWriter from here instead of py, to make it easier to
+# extend or swap our own implementation in the future.
+from py.io import TerminalWriter as TerminalWriter # noqa: F401
diff --git c/tox.ini i/tox.ini
index fae23b882..707f239d0 100644
--- c/tox.ini
+++ i/tox.ini
@@ -189,8 +189,6 @@ markers =
[flake8]
max-line-length = 120
extend-ignore = E203
-per-file-ignores =
- src/_pytest/_io/__init__.py: F401
[isort]
; This config mimics what reorder-python-imports does. |
39e01f5
to
daddd97
Compare
daddd97
to
1f830cd
Compare
This also imports `TerminalWriter` explicitly via `_pytest._io`, allowing for easier extending / replacing it.
1f830cd
to
03bc8ab
Compare
This also imports
TerminalWriter
explicitly, allowing for easierphasing out / replacing of it (via the import, which then could go
through the
_pytest.compat
module).Note to self: