summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2015-01-13 10:04:24 +0100
committerVictor Stinner <victor.stinner@gmail.com>2015-01-13 10:04:24 +0100
commit81052bee65e9e1c687d9052e64e8c0928dde950b (patch)
treee77b7646aff93e7b728064a1f9dbe1d61c2d36d7 /tests
parent5aa19c06b0afb5b778016132875274f44aa3bab7 (diff)
downloadtrollius-81052bee65e9e1c687d9052e64e8c0928dde950b.tar.gz
Python issue #23209, #23225: selectors.BaseSelector.get_key() now raises a
RuntimeError if the selector is closed. And selectors.BaseSelector.close() now clears its internal reference to the selector mapping to break a reference cycle. Initial patch written by Martin Richard.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_selectors.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/tests/test_selectors.py b/tests/test_selectors.py
index 3d5ef91..49b5b8d 100644
--- a/tests/test_selectors.py
+++ b/tests/test_selectors.py
@@ -159,14 +159,17 @@ class BaseSelectorTestCase(unittest.TestCase):
s = self.SELECTOR()
self.addCleanup(s.close)
+ mapping = s.get_map()
rd, wr = self.make_socketpair()
s.register(rd, selectors.EVENT_READ)
s.register(wr, selectors.EVENT_WRITE)
s.close()
- self.assertRaises(KeyError, s.get_key, rd)
- self.assertRaises(KeyError, s.get_key, wr)
+ self.assertRaises(RuntimeError, s.get_key, rd)
+ self.assertRaises(RuntimeError, s.get_key, wr)
+ self.assertRaises(KeyError, mapping.__getitem__, rd)
+ self.assertRaises(KeyError, mapping.__getitem__, wr)
def test_get_key(self):
s = self.SELECTOR()
@@ -233,8 +236,8 @@ class BaseSelectorTestCase(unittest.TestCase):
sel.register(rd, selectors.EVENT_READ)
sel.register(wr, selectors.EVENT_WRITE)
- self.assertRaises(KeyError, s.get_key, rd)
- self.assertRaises(KeyError, s.get_key, wr)
+ self.assertRaises(RuntimeError, s.get_key, rd)
+ self.assertRaises(RuntimeError, s.get_key, wr)
def test_fileno(self):
s = self.SELECTOR()