-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #63 from heuer/issue_61_listener_signal_ref
Listener removes itself from Signal._link
- Loading branch information
Showing
3 changed files
with
42 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
""" | ||
Test against issue <https://github.com/flacjacket/pywayland/issues/61> | ||
""" | ||
|
||
from pywayland.server import Listener, Signal | ||
|
||
|
||
def test_ref_removal(): | ||
|
||
def callback(*_): | ||
pass | ||
|
||
sig = Signal() | ||
listener = Listener(callback) | ||
assert listener._ptr is not None | ||
assert listener._notify is not None | ||
assert listener._signal is None | ||
assert not sig._link | ||
sig.add(listener) | ||
assert len(sig._link) == 1 | ||
assert listener._signal == sig | ||
listener.remove() | ||
assert len(sig._link) == 0 | ||
assert listener._signal is None | ||
assert listener._notify is None | ||
assert listener._ptr is None | ||
|
||
|
||
if __name__ == "__main__": | ||
import pytest | ||
|
||
pytest.main([__file__]) |