From 34560199ba910bc113cbc2044c6daafa9e891d6a Mon Sep 17 00:00:00 2001 From: "A. Jesse Jiryu Davis" Date: Tue, 20 Jan 2015 12:44:04 -0500 Subject: [PATCH] Two test failures on Windows. --- test/test_threads.py | 23 ++++++++++++++++------- test/test_topology.py | 4 ++++ 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/test/test_threads.py b/test/test_threads.py index afacd6a01..27cb2e159 100644 --- a/test/test_threads.py +++ b/test/test_threads.py @@ -16,7 +16,12 @@ import threading -from test import unittest, client_context, IntegrationTest, db_user, db_pwd +from test import (client_context, + client_knobs, + db_user, + db_pwd, + IntegrationTest, + unittest) from test.utils import rs_or_single_client_noauth from test.utils import frequent_thread_switches, joinall from pymongo.errors import OperationFailure @@ -191,14 +196,18 @@ class TestThreads(IntegrationTest): threads.extend(Disconnect(self.db.connection, 10) for _ in range(10)) with frequent_thread_switches(): - for t in threads: - t.start() + # Frequent thread switches hurt performance badly enough to + # prevent reconnection within 5 seconds, especially in Python 2 + # on a Windows build slave. + with client_knobs(server_wait_time=30): + for t in threads: + t.start() - for t in threads: - t.join(30) + for t in threads: + t.join(30) - for t in threads: - self.assertTrue(t.passed) + for t in threads: + self.assertTrue(t.passed) class TestThreadsAuth(IntegrationTest): diff --git a/test/test_topology.py b/test/test_topology.py index fa9397534..41ea576f0 100644 --- a/test/test_topology.py +++ b/test/test_topology.py @@ -20,6 +20,7 @@ sys.path[0:0] = [""] import socket import threading +from unittest import SkipTest from bson.py3compat import imap from pymongo import common @@ -575,6 +576,9 @@ class TestTopologyErrors(TopologyTest): self.assertEqual(SERVER_TYPE.Standalone, get_type(t, 'a')) def test_selection_failure(self): + if sys.platform == 'win32': + raise SkipTest('timing unreliable on Windows') + # While ismaster fails, ensure it's called about every 10 ms. ismaster_count = [0]