proxygen
gtest_shuffle_test.GTestShuffleUnitTest Class Reference
Inheritance diagram for gtest_shuffle_test.GTestShuffleUnitTest:

Public Member Functions

def setUp (self)
 
def testShufflePreservesNumberOfTests (self)
 
def testShuffleChangesTestOrder (self)
 
def testShuffleChangesTestCaseOrder (self)
 
def testShuffleDoesNotRepeatTest (self)
 
def testShuffleDoesNotCreateNewTest (self)
 
def testShuffleIncludesAllTests (self)
 
def testShuffleLeavesDeathTestsAtFront (self)
 
def testShuffleDoesNotInterleaveTestCases (self)
 
def testShuffleRestoresOrderAfterEachIteration (self)
 
def testShuffleGeneratesNewOrderInEachIteration (self)
 
def testShuffleShardedTestsPreservesPartition (self)
 
def setUp (self)
 
def testShufflePreservesNumberOfTests (self)
 
def testShuffleChangesTestOrder (self)
 
def testShuffleChangesTestCaseOrder (self)
 
def testShuffleDoesNotRepeatTest (self)
 
def testShuffleDoesNotCreateNewTest (self)
 
def testShuffleIncludesAllTests (self)
 
def testShuffleLeavesDeathTestsAtFront (self)
 
def testShuffleDoesNotInterleaveTestCases (self)
 
def testShuffleRestoresOrderAfterEachIteration (self)
 
def testShuffleGeneratesNewOrderInEachIteration (self)
 
def testShuffleShardedTestsPreservesPartition (self)
 
def setUp (self)
 
def testShufflePreservesNumberOfTests (self)
 
def testShuffleChangesTestOrder (self)
 
def testShuffleChangesTestCaseOrder (self)
 
def testShuffleDoesNotRepeatTest (self)
 
def testShuffleDoesNotCreateNewTest (self)
 
def testShuffleIncludesAllTests (self)
 
def testShuffleLeavesDeathTestsAtFront (self)
 
def testShuffleDoesNotInterleaveTestCases (self)
 
def testShuffleRestoresOrderAfterEachIteration (self)
 
def testShuffleGeneratesNewOrderInEachIteration (self)
 
def testShuffleShardedTestsPreservesPartition (self)
 

Private Member Functions

def _VerifyTestCasesDoNotInterleave (self, tests)
 
def _VerifyTestCasesDoNotInterleave (self, tests)
 
def _VerifyTestCasesDoNotInterleave (self, tests)
 

Detailed Description

Tests test shuffling.

Definition at line 169 of file gtest_shuffle_test.py.

Member Function Documentation

def gtest_shuffle_test.GTestShuffleUnitTest._VerifyTestCasesDoNotInterleave (   self,
  tests 
)
private

Definition at line 245 of file gtest_shuffle_test.py.

Referenced by gtest_shuffle_test.GTestShuffleUnitTest._VerifyTestCasesDoNotInterleave(), and gtest_shuffle_test.GTestShuffleUnitTest.testShuffleDoesNotInterleaveTestCases().

246  test_cases = []
247  for test in tests:
248  [test_case, _] = test.split('.')
249  if test_cases and test_cases[-1] != test_case:
250  test_cases.append(test_case)
251  self.assertEqual(1, test_cases.count(test_case),
252  'Test case %s is not grouped together in %s' %
253  (test_case, tests))
254 
def gtest_shuffle_test.GTestShuffleUnitTest._VerifyTestCasesDoNotInterleave (   self,
  tests 
)
private

Definition at line 245 of file gtest_shuffle_test.py.

References gtest_shuffle_test.GTestShuffleUnitTest._VerifyTestCasesDoNotInterleave().

246  test_cases = []
247  for test in tests:
248  [test_case, _] = test.split('.')
249  if test_cases and test_cases[-1] != test_case:
250  test_cases.append(test_case)
251  self.assertEqual(1, test_cases.count(test_case),
252  'Test case %s is not grouped together in %s' %
253  (test_case, tests))
254 
def gtest_shuffle_test.GTestShuffleUnitTest._VerifyTestCasesDoNotInterleave (   self,
  tests 
)
private

Definition at line 245 of file gtest_shuffle_test.py.

References gtest_shuffle_test.GTestShuffleUnitTest._VerifyTestCasesDoNotInterleave().

246  test_cases = []
247  for test in tests:
248  [test_case, _] = test.split('.')
249  if test_cases and test_cases[-1] != test_case:
250  test_cases.append(test_case)
251  self.assertEqual(1, test_cases.count(test_case),
252  'Test case %s is not grouped together in %s' %
253  (test_case, tests))
254 
def gtest_shuffle_test.GTestShuffleUnitTest.setUp (   self)
def gtest_shuffle_test.GTestShuffleUnitTest.setUp (   self)
def gtest_shuffle_test.GTestShuffleUnitTest.setUp (   self)
def gtest_shuffle_test.GTestShuffleUnitTest.testShuffleChangesTestCaseOrder (   self)

Definition at line 189 of file gtest_shuffle_test.py.

References gtest_shuffle_test.GetTestCases().

Referenced by gtest_shuffle_test.GTestShuffleUnitTest.testShuffleChangesTestCaseOrder().

190  self.assert_(GetTestCases(SHUFFLED_ALL_TESTS) != GetTestCases(ALL_TESTS),
191  GetTestCases(SHUFFLED_ALL_TESTS))
192  self.assert_(
193  GetTestCases(SHUFFLED_ACTIVE_TESTS) != GetTestCases(ACTIVE_TESTS),
194  GetTestCases(SHUFFLED_ACTIVE_TESTS))
195  self.assert_(
196  GetTestCases(SHUFFLED_FILTERED_TESTS) != GetTestCases(FILTERED_TESTS),
197  GetTestCases(SHUFFLED_FILTERED_TESTS))
198  self.assert_(
199  GetTestCases(SHUFFLED_SHARDED_TESTS) != GetTestCases(SHARDED_TESTS),
200  GetTestCases(SHUFFLED_SHARDED_TESTS))
201 
def gtest_shuffle_test.GTestShuffleUnitTest.testShuffleChangesTestCaseOrder (   self)

Definition at line 189 of file gtest_shuffle_test.py.

References gtest_shuffle_test.GetTestCases(), and gtest_shuffle_test.GTestShuffleUnitTest.testShuffleChangesTestCaseOrder().

190  self.assert_(GetTestCases(SHUFFLED_ALL_TESTS) != GetTestCases(ALL_TESTS),
191  GetTestCases(SHUFFLED_ALL_TESTS))
192  self.assert_(
193  GetTestCases(SHUFFLED_ACTIVE_TESTS) != GetTestCases(ACTIVE_TESTS),
194  GetTestCases(SHUFFLED_ACTIVE_TESTS))
195  self.assert_(
196  GetTestCases(SHUFFLED_FILTERED_TESTS) != GetTestCases(FILTERED_TESTS),
197  GetTestCases(SHUFFLED_FILTERED_TESTS))
198  self.assert_(
199  GetTestCases(SHUFFLED_SHARDED_TESTS) != GetTestCases(SHARDED_TESTS),
200  GetTestCases(SHUFFLED_SHARDED_TESTS))
201 
def gtest_shuffle_test.GTestShuffleUnitTest.testShuffleChangesTestCaseOrder (   self)

Definition at line 189 of file gtest_shuffle_test.py.

References gtest_shuffle_test.GetTestCases(), and gtest_shuffle_test.GTestShuffleUnitTest.testShuffleChangesTestCaseOrder().

190  self.assert_(GetTestCases(SHUFFLED_ALL_TESTS) != GetTestCases(ALL_TESTS),
191  GetTestCases(SHUFFLED_ALL_TESTS))
192  self.assert_(
193  GetTestCases(SHUFFLED_ACTIVE_TESTS) != GetTestCases(ACTIVE_TESTS),
194  GetTestCases(SHUFFLED_ACTIVE_TESTS))
195  self.assert_(
196  GetTestCases(SHUFFLED_FILTERED_TESTS) != GetTestCases(FILTERED_TESTS),
197  GetTestCases(SHUFFLED_FILTERED_TESTS))
198  self.assert_(
199  GetTestCases(SHUFFLED_SHARDED_TESTS) != GetTestCases(SHARDED_TESTS),
200  GetTestCases(SHUFFLED_SHARDED_TESTS))
201 
def gtest_shuffle_test.GTestShuffleUnitTest.testShuffleChangesTestOrder (   self)

Definition at line 181 of file gtest_shuffle_test.py.

References gtest_shuffle_test.GTestShuffleUnitTest.testShuffleChangesTestOrder().

182  self.assert_(SHUFFLED_ALL_TESTS != ALL_TESTS, SHUFFLED_ALL_TESTS)
183  self.assert_(SHUFFLED_ACTIVE_TESTS != ACTIVE_TESTS, SHUFFLED_ACTIVE_TESTS)
184  self.assert_(SHUFFLED_FILTERED_TESTS != FILTERED_TESTS,
185  SHUFFLED_FILTERED_TESTS)
186  self.assert_(SHUFFLED_SHARDED_TESTS != SHARDED_TESTS,
187  SHUFFLED_SHARDED_TESTS)
188 
def gtest_shuffle_test.GTestShuffleUnitTest.testShuffleChangesTestOrder (   self)

Definition at line 181 of file gtest_shuffle_test.py.

References gtest_shuffle_test.GTestShuffleUnitTest.testShuffleChangesTestOrder().

182  self.assert_(SHUFFLED_ALL_TESTS != ALL_TESTS, SHUFFLED_ALL_TESTS)
183  self.assert_(SHUFFLED_ACTIVE_TESTS != ACTIVE_TESTS, SHUFFLED_ACTIVE_TESTS)
184  self.assert_(SHUFFLED_FILTERED_TESTS != FILTERED_TESTS,
185  SHUFFLED_FILTERED_TESTS)
186  self.assert_(SHUFFLED_SHARDED_TESTS != SHARDED_TESTS,
187  SHUFFLED_SHARDED_TESTS)
188 
def gtest_shuffle_test.GTestShuffleUnitTest.testShuffleChangesTestOrder (   self)

Definition at line 181 of file gtest_shuffle_test.py.

Referenced by gtest_shuffle_test.GTestShuffleUnitTest.testShuffleChangesTestOrder().

182  self.assert_(SHUFFLED_ALL_TESTS != ALL_TESTS, SHUFFLED_ALL_TESTS)
183  self.assert_(SHUFFLED_ACTIVE_TESTS != ACTIVE_TESTS, SHUFFLED_ACTIVE_TESTS)
184  self.assert_(SHUFFLED_FILTERED_TESTS != FILTERED_TESTS,
185  SHUFFLED_FILTERED_TESTS)
186  self.assert_(SHUFFLED_SHARDED_TESTS != SHARDED_TESTS,
187  SHUFFLED_SHARDED_TESTS)
188 
def gtest_shuffle_test.GTestShuffleUnitTest.testShuffleDoesNotCreateNewTest (   self)

Definition at line 216 of file gtest_shuffle_test.py.

References gtest_shuffle_test.GTestShuffleUnitTest.testShuffleDoesNotCreateNewTest().

217  for test in SHUFFLED_ALL_TESTS:
218  self.assert_(test in ALL_TESTS, '%s is an invalid test' % (test,))
219  for test in SHUFFLED_ACTIVE_TESTS:
220  self.assert_(test in ACTIVE_TESTS, '%s is an invalid test' % (test,))
221  for test in SHUFFLED_FILTERED_TESTS:
222  self.assert_(test in FILTERED_TESTS, '%s is an invalid test' % (test,))
223  for test in SHUFFLED_SHARDED_TESTS:
224  self.assert_(test in SHARDED_TESTS, '%s is an invalid test' % (test,))
225 
def gtest_shuffle_test.GTestShuffleUnitTest.testShuffleDoesNotCreateNewTest (   self)

Definition at line 216 of file gtest_shuffle_test.py.

References gtest_shuffle_test.GTestShuffleUnitTest.testShuffleDoesNotCreateNewTest().

217  for test in SHUFFLED_ALL_TESTS:
218  self.assert_(test in ALL_TESTS, '%s is an invalid test' % (test,))
219  for test in SHUFFLED_ACTIVE_TESTS:
220  self.assert_(test in ACTIVE_TESTS, '%s is an invalid test' % (test,))
221  for test in SHUFFLED_FILTERED_TESTS:
222  self.assert_(test in FILTERED_TESTS, '%s is an invalid test' % (test,))
223  for test in SHUFFLED_SHARDED_TESTS:
224  self.assert_(test in SHARDED_TESTS, '%s is an invalid test' % (test,))
225 
def gtest_shuffle_test.GTestShuffleUnitTest.testShuffleDoesNotCreateNewTest (   self)

Definition at line 216 of file gtest_shuffle_test.py.

Referenced by gtest_shuffle_test.GTestShuffleUnitTest.testShuffleDoesNotCreateNewTest().

217  for test in SHUFFLED_ALL_TESTS:
218  self.assert_(test in ALL_TESTS, '%s is an invalid test' % (test,))
219  for test in SHUFFLED_ACTIVE_TESTS:
220  self.assert_(test in ACTIVE_TESTS, '%s is an invalid test' % (test,))
221  for test in SHUFFLED_FILTERED_TESTS:
222  self.assert_(test in FILTERED_TESTS, '%s is an invalid test' % (test,))
223  for test in SHUFFLED_SHARDED_TESTS:
224  self.assert_(test in SHARDED_TESTS, '%s is an invalid test' % (test,))
225 
def gtest_shuffle_test.GTestShuffleUnitTest.testShuffleDoesNotInterleaveTestCases (   self)
def gtest_shuffle_test.GTestShuffleUnitTest.testShuffleDoesNotInterleaveTestCases (   self)
def gtest_shuffle_test.GTestShuffleUnitTest.testShuffleDoesNotInterleaveTestCases (   self)
def gtest_shuffle_test.GTestShuffleUnitTest.testShuffleDoesNotRepeatTest (   self)

Definition at line 202 of file gtest_shuffle_test.py.

References gtest_shuffle_test.GTestShuffleUnitTest.testShuffleDoesNotRepeatTest().

203  for test in SHUFFLED_ALL_TESTS:
204  self.assertEqual(1, SHUFFLED_ALL_TESTS.count(test),
205  '%s appears more than once' % (test,))
206  for test in SHUFFLED_ACTIVE_TESTS:
207  self.assertEqual(1, SHUFFLED_ACTIVE_TESTS.count(test),
208  '%s appears more than once' % (test,))
209  for test in SHUFFLED_FILTERED_TESTS:
210  self.assertEqual(1, SHUFFLED_FILTERED_TESTS.count(test),
211  '%s appears more than once' % (test,))
212  for test in SHUFFLED_SHARDED_TESTS:
213  self.assertEqual(1, SHUFFLED_SHARDED_TESTS.count(test),
214  '%s appears more than once' % (test,))
215 
def gtest_shuffle_test.GTestShuffleUnitTest.testShuffleDoesNotRepeatTest (   self)

Definition at line 202 of file gtest_shuffle_test.py.

Referenced by gtest_shuffle_test.GTestShuffleUnitTest.testShuffleDoesNotRepeatTest().

203  for test in SHUFFLED_ALL_TESTS:
204  self.assertEqual(1, SHUFFLED_ALL_TESTS.count(test),
205  '%s appears more than once' % (test,))
206  for test in SHUFFLED_ACTIVE_TESTS:
207  self.assertEqual(1, SHUFFLED_ACTIVE_TESTS.count(test),
208  '%s appears more than once' % (test,))
209  for test in SHUFFLED_FILTERED_TESTS:
210  self.assertEqual(1, SHUFFLED_FILTERED_TESTS.count(test),
211  '%s appears more than once' % (test,))
212  for test in SHUFFLED_SHARDED_TESTS:
213  self.assertEqual(1, SHUFFLED_SHARDED_TESTS.count(test),
214  '%s appears more than once' % (test,))
215 
def gtest_shuffle_test.GTestShuffleUnitTest.testShuffleDoesNotRepeatTest (   self)

Definition at line 202 of file gtest_shuffle_test.py.

References gtest_shuffle_test.GTestShuffleUnitTest.testShuffleDoesNotRepeatTest().

203  for test in SHUFFLED_ALL_TESTS:
204  self.assertEqual(1, SHUFFLED_ALL_TESTS.count(test),
205  '%s appears more than once' % (test,))
206  for test in SHUFFLED_ACTIVE_TESTS:
207  self.assertEqual(1, SHUFFLED_ACTIVE_TESTS.count(test),
208  '%s appears more than once' % (test,))
209  for test in SHUFFLED_FILTERED_TESTS:
210  self.assertEqual(1, SHUFFLED_FILTERED_TESTS.count(test),
211  '%s appears more than once' % (test,))
212  for test in SHUFFLED_SHARDED_TESTS:
213  self.assertEqual(1, SHUFFLED_SHARDED_TESTS.count(test),
214  '%s appears more than once' % (test,))
215 
def gtest_shuffle_test.GTestShuffleUnitTest.testShuffleGeneratesNewOrderInEachIteration (   self)

Definition at line 293 of file gtest_shuffle_test.py.

References gtest_shuffle_test.GetTestsForAllIterations(), gtest_shuffle_test.RandomSeedFlag(), gtest_shuffle_test.RepeatFlag(), gtest_shuffle_test.ShuffleFlag(), and gtest_shuffle_test.GTestShuffleUnitTest.testShuffleGeneratesNewOrderInEachIteration().

294  [tests_in_iteration1, tests_in_iteration2, tests_in_iteration3] = (
296  {}, [ShuffleFlag(), RandomSeedFlag(1), RepeatFlag(3)]))
297 
298  self.assert_(tests_in_iteration1 != tests_in_iteration2,
299  tests_in_iteration1)
300  self.assert_(tests_in_iteration1 != tests_in_iteration3,
301  tests_in_iteration1)
302  self.assert_(tests_in_iteration2 != tests_in_iteration3,
303  tests_in_iteration2)
304 
def GetTestsForAllIterations(extra_env, args)
def gtest_shuffle_test.GTestShuffleUnitTest.testShuffleGeneratesNewOrderInEachIteration (   self)

Definition at line 293 of file gtest_shuffle_test.py.

References gtest_shuffle_test.GetTestsForAllIterations(), gtest_shuffle_test.RandomSeedFlag(), gtest_shuffle_test.RepeatFlag(), and gtest_shuffle_test.ShuffleFlag().

Referenced by gtest_shuffle_test.GTestShuffleUnitTest.testShuffleGeneratesNewOrderInEachIteration().

294  [tests_in_iteration1, tests_in_iteration2, tests_in_iteration3] = (
296  {}, [ShuffleFlag(), RandomSeedFlag(1), RepeatFlag(3)]))
297 
298  self.assert_(tests_in_iteration1 != tests_in_iteration2,
299  tests_in_iteration1)
300  self.assert_(tests_in_iteration1 != tests_in_iteration3,
301  tests_in_iteration1)
302  self.assert_(tests_in_iteration2 != tests_in_iteration3,
303  tests_in_iteration2)
304 
def GetTestsForAllIterations(extra_env, args)
def gtest_shuffle_test.GTestShuffleUnitTest.testShuffleGeneratesNewOrderInEachIteration (   self)

Definition at line 293 of file gtest_shuffle_test.py.

References gtest_shuffle_test.GetTestsForAllIterations(), gtest_shuffle_test.RandomSeedFlag(), gtest_shuffle_test.RepeatFlag(), gtest_shuffle_test.ShuffleFlag(), and gtest_shuffle_test.GTestShuffleUnitTest.testShuffleGeneratesNewOrderInEachIteration().

294  [tests_in_iteration1, tests_in_iteration2, tests_in_iteration3] = (
296  {}, [ShuffleFlag(), RandomSeedFlag(1), RepeatFlag(3)]))
297 
298  self.assert_(tests_in_iteration1 != tests_in_iteration2,
299  tests_in_iteration1)
300  self.assert_(tests_in_iteration1 != tests_in_iteration3,
301  tests_in_iteration1)
302  self.assert_(tests_in_iteration2 != tests_in_iteration3,
303  tests_in_iteration2)
304 
def GetTestsForAllIterations(extra_env, args)
def gtest_shuffle_test.GTestShuffleUnitTest.testShuffleIncludesAllTests (   self)

Definition at line 226 of file gtest_shuffle_test.py.

References gtest_shuffle_test.GTestShuffleUnitTest.testShuffleIncludesAllTests().

227  for test in ALL_TESTS:
228  self.assert_(test in SHUFFLED_ALL_TESTS, '%s is missing' % (test,))
229  for test in ACTIVE_TESTS:
230  self.assert_(test in SHUFFLED_ACTIVE_TESTS, '%s is missing' % (test,))
231  for test in FILTERED_TESTS:
232  self.assert_(test in SHUFFLED_FILTERED_TESTS, '%s is missing' % (test,))
233  for test in SHARDED_TESTS:
234  self.assert_(test in SHUFFLED_SHARDED_TESTS, '%s is missing' % (test,))
235 
def gtest_shuffle_test.GTestShuffleUnitTest.testShuffleIncludesAllTests (   self)

Definition at line 226 of file gtest_shuffle_test.py.

References gtest_shuffle_test.GTestShuffleUnitTest.testShuffleIncludesAllTests().

227  for test in ALL_TESTS:
228  self.assert_(test in SHUFFLED_ALL_TESTS, '%s is missing' % (test,))
229  for test in ACTIVE_TESTS:
230  self.assert_(test in SHUFFLED_ACTIVE_TESTS, '%s is missing' % (test,))
231  for test in FILTERED_TESTS:
232  self.assert_(test in SHUFFLED_FILTERED_TESTS, '%s is missing' % (test,))
233  for test in SHARDED_TESTS:
234  self.assert_(test in SHUFFLED_SHARDED_TESTS, '%s is missing' % (test,))
235 
def gtest_shuffle_test.GTestShuffleUnitTest.testShuffleIncludesAllTests (   self)

Definition at line 226 of file gtest_shuffle_test.py.

Referenced by gtest_shuffle_test.GTestShuffleUnitTest.testShuffleIncludesAllTests().

227  for test in ALL_TESTS:
228  self.assert_(test in SHUFFLED_ALL_TESTS, '%s is missing' % (test,))
229  for test in ACTIVE_TESTS:
230  self.assert_(test in SHUFFLED_ACTIVE_TESTS, '%s is missing' % (test,))
231  for test in FILTERED_TESTS:
232  self.assert_(test in SHUFFLED_FILTERED_TESTS, '%s is missing' % (test,))
233  for test in SHARDED_TESTS:
234  self.assert_(test in SHUFFLED_SHARDED_TESTS, '%s is missing' % (test,))
235 
def gtest_shuffle_test.GTestShuffleUnitTest.testShuffleLeavesDeathTestsAtFront (   self)

Definition at line 236 of file gtest_shuffle_test.py.

References gtest_shuffle_test.GTestShuffleUnitTest.testShuffleLeavesDeathTestsAtFront().

237  non_death_test_found = False
238  for test in SHUFFLED_ACTIVE_TESTS:
239  if 'DeathTest.' in test:
240  self.assert_(not non_death_test_found,
241  '%s appears after a non-death test' % (test,))
242  else:
243  non_death_test_found = True
244 
def gtest_shuffle_test.GTestShuffleUnitTest.testShuffleLeavesDeathTestsAtFront (   self)

Definition at line 236 of file gtest_shuffle_test.py.

References gtest_shuffle_test.GTestShuffleUnitTest.testShuffleLeavesDeathTestsAtFront().

237  non_death_test_found = False
238  for test in SHUFFLED_ACTIVE_TESTS:
239  if 'DeathTest.' in test:
240  self.assert_(not non_death_test_found,
241  '%s appears after a non-death test' % (test,))
242  else:
243  non_death_test_found = True
244 
def gtest_shuffle_test.GTestShuffleUnitTest.testShuffleLeavesDeathTestsAtFront (   self)

Definition at line 236 of file gtest_shuffle_test.py.

Referenced by gtest_shuffle_test.GTestShuffleUnitTest.testShuffleLeavesDeathTestsAtFront().

237  non_death_test_found = False
238  for test in SHUFFLED_ACTIVE_TESTS:
239  if 'DeathTest.' in test:
240  self.assert_(not non_death_test_found,
241  '%s appears after a non-death test' % (test,))
242  else:
243  non_death_test_found = True
244 
def gtest_shuffle_test.GTestShuffleUnitTest.testShufflePreservesNumberOfTests (   self)

Definition at line 175 of file gtest_shuffle_test.py.

Referenced by gtest_shuffle_test.GTestShuffleUnitTest.testShufflePreservesNumberOfTests().

176  self.assertEqual(len(ALL_TESTS), len(SHUFFLED_ALL_TESTS))
177  self.assertEqual(len(ACTIVE_TESTS), len(SHUFFLED_ACTIVE_TESTS))
178  self.assertEqual(len(FILTERED_TESTS), len(SHUFFLED_FILTERED_TESTS))
179  self.assertEqual(len(SHARDED_TESTS), len(SHUFFLED_SHARDED_TESTS))
180 
def gtest_shuffle_test.GTestShuffleUnitTest.testShufflePreservesNumberOfTests (   self)

Definition at line 175 of file gtest_shuffle_test.py.

References gtest_shuffle_test.GTestShuffleUnitTest.testShufflePreservesNumberOfTests().

176  self.assertEqual(len(ALL_TESTS), len(SHUFFLED_ALL_TESTS))
177  self.assertEqual(len(ACTIVE_TESTS), len(SHUFFLED_ACTIVE_TESTS))
178  self.assertEqual(len(FILTERED_TESTS), len(SHUFFLED_FILTERED_TESTS))
179  self.assertEqual(len(SHARDED_TESTS), len(SHUFFLED_SHARDED_TESTS))
180 
def gtest_shuffle_test.GTestShuffleUnitTest.testShufflePreservesNumberOfTests (   self)

Definition at line 175 of file gtest_shuffle_test.py.

References gtest_shuffle_test.GTestShuffleUnitTest.testShufflePreservesNumberOfTests().

176  self.assertEqual(len(ALL_TESTS), len(SHUFFLED_ALL_TESTS))
177  self.assertEqual(len(ACTIVE_TESTS), len(SHUFFLED_ACTIVE_TESTS))
178  self.assertEqual(len(FILTERED_TESTS), len(SHUFFLED_FILTERED_TESTS))
179  self.assertEqual(len(SHARDED_TESTS), len(SHUFFLED_SHARDED_TESTS))
180 
def gtest_shuffle_test.GTestShuffleUnitTest.testShuffleRestoresOrderAfterEachIteration (   self)

Definition at line 261 of file gtest_shuffle_test.py.

References gtest_shuffle_test.GetTestsForAllIterations(), gtest_shuffle_test.RandomSeedFlag(), gtest_shuffle_test.RepeatFlag(), and gtest_shuffle_test.ShuffleFlag().

Referenced by gtest_shuffle_test.GTestShuffleUnitTest.testShuffleRestoresOrderAfterEachIteration().

262  # Get the test lists in all 3 iterations, using random seed 1, 2,
263  # and 3 respectively. Google Test picks a different seed in each
264  # iteration, and this test depends on the current implementation
265  # picking successive numbers. This dependency is not ideal, but
266  # makes the test much easier to write.
267  [tests_in_iteration1, tests_in_iteration2, tests_in_iteration3] = (
269  {}, [ShuffleFlag(), RandomSeedFlag(1), RepeatFlag(3)]))
270 
271  # Make sure running the tests with random seed 1 gets the same
272  # order as in iteration 1 above.
273  [tests_with_seed1] = GetTestsForAllIterations(
274  {}, [ShuffleFlag(), RandomSeedFlag(1)])
275  self.assertEqual(tests_in_iteration1, tests_with_seed1)
276 
277  # Make sure running the tests with random seed 2 gets the same
278  # order as in iteration 2 above. Success means that Google Test
279  # correctly restores the test order before re-shuffling at the
280  # beginning of iteration 2.
281  [tests_with_seed2] = GetTestsForAllIterations(
282  {}, [ShuffleFlag(), RandomSeedFlag(2)])
283  self.assertEqual(tests_in_iteration2, tests_with_seed2)
284 
285  # Make sure running the tests with random seed 3 gets the same
286  # order as in iteration 3 above. Success means that Google Test
287  # correctly restores the test order before re-shuffling at the
288  # beginning of iteration 3.
289  [tests_with_seed3] = GetTestsForAllIterations(
290  {}, [ShuffleFlag(), RandomSeedFlag(3)])
291  self.assertEqual(tests_in_iteration3, tests_with_seed3)
292 
def GetTestsForAllIterations(extra_env, args)
def gtest_shuffle_test.GTestShuffleUnitTest.testShuffleRestoresOrderAfterEachIteration (   self)

Definition at line 261 of file gtest_shuffle_test.py.

References gtest_shuffle_test.GetTestsForAllIterations(), gtest_shuffle_test.RandomSeedFlag(), gtest_shuffle_test.RepeatFlag(), gtest_shuffle_test.ShuffleFlag(), and gtest_shuffle_test.GTestShuffleUnitTest.testShuffleRestoresOrderAfterEachIteration().

262  # Get the test lists in all 3 iterations, using random seed 1, 2,
263  # and 3 respectively. Google Test picks a different seed in each
264  # iteration, and this test depends on the current implementation
265  # picking successive numbers. This dependency is not ideal, but
266  # makes the test much easier to write.
267  [tests_in_iteration1, tests_in_iteration2, tests_in_iteration3] = (
269  {}, [ShuffleFlag(), RandomSeedFlag(1), RepeatFlag(3)]))
270 
271  # Make sure running the tests with random seed 1 gets the same
272  # order as in iteration 1 above.
273  [tests_with_seed1] = GetTestsForAllIterations(
274  {}, [ShuffleFlag(), RandomSeedFlag(1)])
275  self.assertEqual(tests_in_iteration1, tests_with_seed1)
276 
277  # Make sure running the tests with random seed 2 gets the same
278  # order as in iteration 2 above. Success means that Google Test
279  # correctly restores the test order before re-shuffling at the
280  # beginning of iteration 2.
281  [tests_with_seed2] = GetTestsForAllIterations(
282  {}, [ShuffleFlag(), RandomSeedFlag(2)])
283  self.assertEqual(tests_in_iteration2, tests_with_seed2)
284 
285  # Make sure running the tests with random seed 3 gets the same
286  # order as in iteration 3 above. Success means that Google Test
287  # correctly restores the test order before re-shuffling at the
288  # beginning of iteration 3.
289  [tests_with_seed3] = GetTestsForAllIterations(
290  {}, [ShuffleFlag(), RandomSeedFlag(3)])
291  self.assertEqual(tests_in_iteration3, tests_with_seed3)
292 
def GetTestsForAllIterations(extra_env, args)
def gtest_shuffle_test.GTestShuffleUnitTest.testShuffleRestoresOrderAfterEachIteration (   self)

Definition at line 261 of file gtest_shuffle_test.py.

References gtest_shuffle_test.GetTestsForAllIterations(), gtest_shuffle_test.RandomSeedFlag(), gtest_shuffle_test.RepeatFlag(), gtest_shuffle_test.ShuffleFlag(), and gtest_shuffle_test.GTestShuffleUnitTest.testShuffleRestoresOrderAfterEachIteration().

262  # Get the test lists in all 3 iterations, using random seed 1, 2,
263  # and 3 respectively. Google Test picks a different seed in each
264  # iteration, and this test depends on the current implementation
265  # picking successive numbers. This dependency is not ideal, but
266  # makes the test much easier to write.
267  [tests_in_iteration1, tests_in_iteration2, tests_in_iteration3] = (
269  {}, [ShuffleFlag(), RandomSeedFlag(1), RepeatFlag(3)]))
270 
271  # Make sure running the tests with random seed 1 gets the same
272  # order as in iteration 1 above.
273  [tests_with_seed1] = GetTestsForAllIterations(
274  {}, [ShuffleFlag(), RandomSeedFlag(1)])
275  self.assertEqual(tests_in_iteration1, tests_with_seed1)
276 
277  # Make sure running the tests with random seed 2 gets the same
278  # order as in iteration 2 above. Success means that Google Test
279  # correctly restores the test order before re-shuffling at the
280  # beginning of iteration 2.
281  [tests_with_seed2] = GetTestsForAllIterations(
282  {}, [ShuffleFlag(), RandomSeedFlag(2)])
283  self.assertEqual(tests_in_iteration2, tests_with_seed2)
284 
285  # Make sure running the tests with random seed 3 gets the same
286  # order as in iteration 3 above. Success means that Google Test
287  # correctly restores the test order before re-shuffling at the
288  # beginning of iteration 3.
289  [tests_with_seed3] = GetTestsForAllIterations(
290  {}, [ShuffleFlag(), RandomSeedFlag(3)])
291  self.assertEqual(tests_in_iteration3, tests_with_seed3)
292 
def GetTestsForAllIterations(extra_env, args)
def gtest_shuffle_test.GTestShuffleUnitTest.testShuffleShardedTestsPreservesPartition (   self)

Definition at line 305 of file gtest_shuffle_test.py.

References gtest_shuffle_test.GetTestsForAllIterations(), gtest_test_utils.Main(), gtest_shuffle_test.RandomSeedFlag(), and gtest_shuffle_test.ShuffleFlag().

Referenced by gtest_shuffle_test.GTestShuffleUnitTest.testShuffleShardedTestsPreservesPartition().

306  # If we run M tests on N shards, the same M tests should be run in
307  # total, regardless of the random seeds used by the shards.
308  [tests1] = GetTestsForAllIterations({TOTAL_SHARDS_ENV_VAR: '3',
309  SHARD_INDEX_ENV_VAR: '0'},
310  [ShuffleFlag(), RandomSeedFlag(1)])
311  [tests2] = GetTestsForAllIterations({TOTAL_SHARDS_ENV_VAR: '3',
312  SHARD_INDEX_ENV_VAR: '1'},
313  [ShuffleFlag(), RandomSeedFlag(20)])
314  [tests3] = GetTestsForAllIterations({TOTAL_SHARDS_ENV_VAR: '3',
315  SHARD_INDEX_ENV_VAR: '2'},
316  [ShuffleFlag(), RandomSeedFlag(25)])
317  sorted_sharded_tests = tests1 + tests2 + tests3
318  sorted_sharded_tests.sort()
319  sorted_active_tests = []
320  sorted_active_tests.extend(ACTIVE_TESTS)
321  sorted_active_tests.sort()
322  self.assertEqual(sorted_active_tests, sorted_sharded_tests)
323 
def GetTestsForAllIterations(extra_env, args)
def gtest_shuffle_test.GTestShuffleUnitTest.testShuffleShardedTestsPreservesPartition (   self)

Definition at line 305 of file gtest_shuffle_test.py.

References gtest_shuffle_test.GetTestsForAllIterations(), gtest_test_utils.Main(), gtest_shuffle_test.RandomSeedFlag(), gtest_shuffle_test.ShuffleFlag(), and gtest_shuffle_test.GTestShuffleUnitTest.testShuffleShardedTestsPreservesPartition().

306  # If we run M tests on N shards, the same M tests should be run in
307  # total, regardless of the random seeds used by the shards.
308  [tests1] = GetTestsForAllIterations({TOTAL_SHARDS_ENV_VAR: '3',
309  SHARD_INDEX_ENV_VAR: '0'},
310  [ShuffleFlag(), RandomSeedFlag(1)])
311  [tests2] = GetTestsForAllIterations({TOTAL_SHARDS_ENV_VAR: '3',
312  SHARD_INDEX_ENV_VAR: '1'},
313  [ShuffleFlag(), RandomSeedFlag(20)])
314  [tests3] = GetTestsForAllIterations({TOTAL_SHARDS_ENV_VAR: '3',
315  SHARD_INDEX_ENV_VAR: '2'},
316  [ShuffleFlag(), RandomSeedFlag(25)])
317  sorted_sharded_tests = tests1 + tests2 + tests3
318  sorted_sharded_tests.sort()
319  sorted_active_tests = []
320  sorted_active_tests.extend(ACTIVE_TESTS)
321  sorted_active_tests.sort()
322  self.assertEqual(sorted_active_tests, sorted_sharded_tests)
323 
def GetTestsForAllIterations(extra_env, args)
def gtest_shuffle_test.GTestShuffleUnitTest.testShuffleShardedTestsPreservesPartition (   self)

Definition at line 305 of file gtest_shuffle_test.py.

References gtest_shuffle_test.GetTestsForAllIterations(), gtest_test_utils.Main(), gtest_shuffle_test.RandomSeedFlag(), gtest_shuffle_test.ShuffleFlag(), and gtest_shuffle_test.GTestShuffleUnitTest.testShuffleShardedTestsPreservesPartition().

306  # If we run M tests on N shards, the same M tests should be run in
307  # total, regardless of the random seeds used by the shards.
308  [tests1] = GetTestsForAllIterations({TOTAL_SHARDS_ENV_VAR: '3',
309  SHARD_INDEX_ENV_VAR: '0'},
310  [ShuffleFlag(), RandomSeedFlag(1)])
311  [tests2] = GetTestsForAllIterations({TOTAL_SHARDS_ENV_VAR: '3',
312  SHARD_INDEX_ENV_VAR: '1'},
313  [ShuffleFlag(), RandomSeedFlag(20)])
314  [tests3] = GetTestsForAllIterations({TOTAL_SHARDS_ENV_VAR: '3',
315  SHARD_INDEX_ENV_VAR: '2'},
316  [ShuffleFlag(), RandomSeedFlag(25)])
317  sorted_sharded_tests = tests1 + tests2 + tests3
318  sorted_sharded_tests.sort()
319  sorted_active_tests = []
320  sorted_active_tests.extend(ACTIVE_TESTS)
321  sorted_active_tests.sort()
322  self.assertEqual(sorted_active_tests, sorted_sharded_tests)
323 
def GetTestsForAllIterations(extra_env, args)

The documentation for this class was generated from the following file: