Skip to content

Commit

Permalink
Fix attrs redone (#3058)
Browse files Browse the repository at this point in the history
* Catch deprecation warnings on import

* Fix deprecation warning from attrs

* Fix testcase

* Appease linters

* Fix test case
  • Loading branch information
A5rocks committed Aug 8, 2024
1 parent a50fcaa commit 6fe02c0
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
8 changes: 8 additions & 0 deletions src/trio/_tests/test_trio.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
def test_trio_import() -> None:
import sys

for module in list(sys.modules.keys()):
if module.startswith("trio"):
del sys.modules[module]

import trio # noqa: F401
6 changes: 5 additions & 1 deletion src/trio/_tests/tools/test_mypy_annotate.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ def test_endtoend(
monkeypatch: pytest.MonkeyPatch,
capsys: pytest.CaptureFixture[str],
) -> None:
import trio._tools.mypy_annotate as mypy_annotate

inp_text = """\
Mypy begun
trio/core.py:15: error: Bad types here [misc]
Expand All @@ -116,7 +118,9 @@ def test_endtoend(
with monkeypatch.context():
monkeypatch.setattr(sys, "stdin", io.StringIO(inp_text))

main(["--dumpfile", str(result_file), "--platform", "SomePlatform"])
mypy_annotate.main(
["--dumpfile", str(result_file), "--platform", "SomePlatform"]
)

std = capsys.readouterr()
assert std.err == ""
Expand Down
2 changes: 1 addition & 1 deletion src/trio/_threads.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def current_default_thread_limiter() -> CapacityLimiter:
# system; see https://github.com/python-trio/trio/issues/182
# But for now we just need an object to stand in for the thread, so we can
# keep track of who's holding the CapacityLimiter's token.
@attrs.frozen(eq=False, hash=False, slots=False)
@attrs.frozen(eq=False, slots=False)
class ThreadPlaceholder:
name: str

Expand Down

0 comments on commit 6fe02c0

Please sign in to comment.