(self)
| 1928 | |
| 1929 | @unittest.skipIf("PyPy" in sys.version, "PYTHON-2938 could fail on PyPy") |
| 1930 | def test_process_periodic_tasks(self): |
| 1931 | client = self.rs_or_single_client() |
| 1932 | coll = client.db.collection |
| 1933 | coll.insert_many([{} for _ in range(5)]) |
| 1934 | cursor = coll.find(batch_size=2) |
| 1935 | cursor.next() |
| 1936 | c_id = cursor.cursor_id |
| 1937 | self.assertIsNotNone(c_id) |
| 1938 | client.close() |
| 1939 | # Add cursor to kill cursors queue |
| 1940 | del cursor |
| 1941 | wait_until( |
| 1942 | lambda: client._kill_cursors_queue, |
| 1943 | "waited for cursor to be added to queue", |
| 1944 | ) |
| 1945 | client._process_periodic_tasks() # This must not raise or print any exceptions |
| 1946 | with self.assertRaises(InvalidOperation): |
| 1947 | coll.insert_many([{} for _ in range(5)]) |
| 1948 | |
| 1949 | def test_service_name_from_kwargs(self): |
| 1950 | client = MongoClient( |
nothing calls this directly
no test coverage detected