actually at the new test
This commit is contained in:
		
							
								
								
									
										38
									
								
								tests/unit/test_cluster_task_scheduler.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								tests/unit/test_cluster_task_scheduler.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,38 @@ | |||||||
|  | # Copyright 2013-2016 DataStax, Inc. | ||||||
|  | # | ||||||
|  | # Licensed under the Apache License, Version 2.0 (the "License"); | ||||||
|  | # you may not use this file except in compliance with the License. | ||||||
|  | # You may obtain a copy of the License at | ||||||
|  | # | ||||||
|  | # http://www.apache.org/licenses/LICENSE-2.0 | ||||||
|  | # | ||||||
|  | # Unless required by applicable law or agreed to in writing, software | ||||||
|  | # distributed under the License is distributed on an "AS IS" BASIS, | ||||||
|  | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||||
|  | # See the License for the specific language governing permissions and | ||||||
|  | # limitations under the License. | ||||||
|  |  | ||||||
|  | try: | ||||||
|  |     import unittest2 as unittest | ||||||
|  | except ImportError: | ||||||
|  |     import unittest  # noqa | ||||||
|  |  | ||||||
|  | from mock import patch | ||||||
|  |  | ||||||
|  | from cassandra.cluster import _Scheduler | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class SchedulerTest(unittest.TestCase): | ||||||
|  |     # TODO: this suite could be expanded; for now just adding a test covering a ticket | ||||||
|  |  | ||||||
|  |     @patch('time.time', return_value=3)  # always queue at same time | ||||||
|  |     @patch('cassandra.cluster._Scheduler.run')  # don't actually run the thread | ||||||
|  |     def test_event_delay_timing(self, *args): | ||||||
|  |         """ | ||||||
|  |         Schedule something with a time collision to make sure the heap comparison works | ||||||
|  |  | ||||||
|  |         PYTHON-473 | ||||||
|  |         """ | ||||||
|  |         sched = _Scheduler(None) | ||||||
|  |         sched.schedule(0, lambda: None) | ||||||
|  |         sched.schedule(0, lambda: None)  # pre-473: "TypeError: unorderable types: function() < function()"t | ||||||
		Reference in New Issue
	
	Block a user
	 Adam Holmberg
					Adam Holmberg