Skip to content

Commit 916488e

Browse files
ajdavisbehackett
authored andcommitted
Delete racy test_selection_failure.
1 parent 6a50a04 commit 916488e

File tree

1 file changed

+1
-25
lines changed

1 file changed

+1
-25
lines changed

test/test_topology.py

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
from pymongo.server_selectors import (any_server_selector,
3737
writable_server_selector)
3838
from pymongo.settings import TopologySettings
39-
from test import client_knobs, SkipTest, unittest
39+
from test import client_knobs, unittest
4040
from test.utils import wait_until
4141

4242

@@ -574,30 +574,6 @@ def _check_with_socket(self, sock_info):
574574
self.assertEqual(3, ismaster_count[0])
575575
self.assertEqual(SERVER_TYPE.Standalone, get_type(t, 'a'))
576576

577-
def test_selection_failure(self):
578-
if sys.platform == 'win32':
579-
raise SkipTest('timing unreliable on Windows')
580-
581-
# While ismaster fails, ensure it's called about every 10 ms.
582-
ismaster_count = [0]
583-
584-
class TestMonitor(Monitor):
585-
def _check_with_socket(self, sock_info):
586-
ismaster_count[0] += 1
587-
raise socket.error('my error')
588-
589-
t = create_mock_topology(monitor_class=TestMonitor)
590-
591-
with self.assertRaisesRegex(ConnectionFailure, 'my error'):
592-
# Add slop to prevent rounding error.
593-
t.select_servers(any_server_selector,
594-
server_selection_timeout=0.5)
595-
596-
self.assertTrue(
597-
25 <= ismaster_count[0] <= 100,
598-
"Expected ismaster to be attempted about 50 times, not %d" %
599-
ismaster_count[0])
600-
601577
def test_internal_monitor_error(self):
602578
exception = AssertionError('internal error')
603579

0 commit comments

Comments
 (0)