config: typing for create_terminal_writer, re-export TerminalWriter#6545
config: typing for create_terminal_writer, re-export TerminalWriter#6545blueyed merged 1 commit intopytest-dev:masterfrom
Conversation
bluetech
left a comment
There was a problem hiding this comment.
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 TerminalWriterI 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
TerminalWriterexplicitly, allowing for easierphasing out / replacing of it (via the import, which then could go
through the
_pytest.compatmodule).Note to self: