Skip to content

Commit 6fe02c0

Browse files
authored
Fix attrs redone (#3058)
* Catch deprecation warnings on import * Fix deprecation warning from attrs * Fix testcase * Appease linters * Fix test case
1 parent a50fcaa commit 6fe02c0

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

src/trio/_tests/test_trio.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
def test_trio_import() -> None:
2+
import sys
3+
4+
for module in list(sys.modules.keys()):
5+
if module.startswith("trio"):
6+
del sys.modules[module]
7+
8+
import trio # noqa: F401

src/trio/_tests/tools/test_mypy_annotate.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ def test_endtoend(
105105
monkeypatch: pytest.MonkeyPatch,
106106
capsys: pytest.CaptureFixture[str],
107107
) -> None:
108+
import trio._tools.mypy_annotate as mypy_annotate
109+
108110
inp_text = """\
109111
Mypy begun
110112
trio/core.py:15: error: Bad types here [misc]
@@ -116,7 +118,9 @@ def test_endtoend(
116118
with monkeypatch.context():
117119
monkeypatch.setattr(sys, "stdin", io.StringIO(inp_text))
118120

119-
main(["--dumpfile", str(result_file), "--platform", "SomePlatform"])
121+
mypy_annotate.main(
122+
["--dumpfile", str(result_file), "--platform", "SomePlatform"]
123+
)
120124

121125
std = capsys.readouterr()
122126
assert std.err == ""

src/trio/_threads.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def current_default_thread_limiter() -> CapacityLimiter:
139139
# system; see https://github.com/python-trio/trio/issues/182
140140
# But for now we just need an object to stand in for the thread, so we can
141141
# keep track of who's holding the CapacityLimiter's token.
142-
@attrs.frozen(eq=False, hash=False, slots=False)
142+
@attrs.frozen(eq=False, slots=False)
143143
class ThreadPlaceholder:
144144
name: str
145145

0 commit comments

Comments
 (0)