fix: closes #11343's [attr-defined] type errors
On Windows 10.0.19045, the mypy hook is failing on pre-commit because of two [attr-defined] errors, which prevents me from staging stages. The problem was first reported in #11343. This PR solves the problem by adding `type ignore` comments to the erroring lines: ``` src\_pytest\compat.py:324: error: Module has no attribute "getuid"; maybe "getpid" or "getppid"? [attr-defined] testing\test_parseopt.py:294: error: Module has no attribute "getencoding" [attr-defined] ```
This commit is contained in:
parent
37bb186175
commit
2a91c63318
|
@ -321,7 +321,7 @@ def get_user_id() -> int | None:
|
|||
return None
|
||||
# getuid shouldn't fail, but cpython defines such a case.
|
||||
# Let's hope for the best.
|
||||
uid = os.getuid()
|
||||
uid = os.getuid() # type: ignore[attr-defined]
|
||||
return uid if uid != -1 else None
|
||||
|
||||
|
||||
|
|
|
@ -291,7 +291,8 @@ class TestParser:
|
|||
|
||||
def test_argcomplete(pytester: Pytester, monkeypatch: MonkeyPatch) -> None:
|
||||
try:
|
||||
encoding = locale.getencoding() # New in Python 3.11, ignores utf-8 mode
|
||||
# New in Python 3.11, ignores utf-8 mode
|
||||
encoding = locale.getencoding() # type: ignore[attr-defined]
|
||||
except AttributeError:
|
||||
encoding = locale.getpreferredencoding(False)
|
||||
try:
|
||||
|
|
Loading…
Reference in New Issue