mirror of
https://github.com/google/googletest.git
synced 2024-12-27 10:11:03 +08:00
Fix pylint warning
Possible unbalanced tuple unpacking with sequence defined at line N: left side has 1 label(s), right side has 0 value(s) [unbalanced-tuple-unpacking] PiperOrigin-RevId: 504640001 Change-Id: If8d6038a9acf74a409cb6b6ee30cea7745b4b303
This commit is contained in:
parent
137dcd18cc
commit
f47d75faf3
@ -275,33 +275,38 @@ class GTestShuffleUnitTest(gtest_test_utils.TestCase):
|
|||||||
# iteration, and this test depends on the current implementation
|
# iteration, and this test depends on the current implementation
|
||||||
# picking successive numbers. This dependency is not ideal, but
|
# picking successive numbers. This dependency is not ideal, but
|
||||||
# makes the test much easier to write.
|
# makes the test much easier to write.
|
||||||
|
# pylint: disable-next=unbalanced-tuple-unpacking
|
||||||
[tests_in_iteration1, tests_in_iteration2, tests_in_iteration3] = (
|
[tests_in_iteration1, tests_in_iteration2, tests_in_iteration3] = (
|
||||||
GetTestsForAllIterations(
|
GetTestsForAllIterations(
|
||||||
{}, [ShuffleFlag(), RandomSeedFlag(1), RepeatFlag(3)]))
|
{}, [ShuffleFlag(), RandomSeedFlag(1), RepeatFlag(3)]))
|
||||||
|
|
||||||
# Make sure running the tests with random seed 1 gets the same
|
# Make sure running the tests with random seed 1 gets the same
|
||||||
# order as in iteration 1 above.
|
# order as in iteration 1 above.
|
||||||
[tests_with_seed1] = GetTestsForAllIterations(
|
tests_with_seed1 = GetTestsForAllIterations(
|
||||||
{}, [ShuffleFlag(), RandomSeedFlag(1)])
|
{}, [ShuffleFlag(), RandomSeedFlag(1)]
|
||||||
|
)[0]
|
||||||
self.assertEqual(tests_in_iteration1, tests_with_seed1)
|
self.assertEqual(tests_in_iteration1, tests_with_seed1)
|
||||||
|
|
||||||
# Make sure running the tests with random seed 2 gets the same
|
# Make sure running the tests with random seed 2 gets the same
|
||||||
# order as in iteration 2 above. Success means that Google Test
|
# order as in iteration 2 above. Success means that Google Test
|
||||||
# correctly restores the test order before re-shuffling at the
|
# correctly restores the test order before re-shuffling at the
|
||||||
# beginning of iteration 2.
|
# beginning of iteration 2.
|
||||||
[tests_with_seed2] = GetTestsForAllIterations(
|
tests_with_seed2 = GetTestsForAllIterations(
|
||||||
{}, [ShuffleFlag(), RandomSeedFlag(2)])
|
{}, [ShuffleFlag(), RandomSeedFlag(2)]
|
||||||
|
)[0]
|
||||||
self.assertEqual(tests_in_iteration2, tests_with_seed2)
|
self.assertEqual(tests_in_iteration2, tests_with_seed2)
|
||||||
|
|
||||||
# Make sure running the tests with random seed 3 gets the same
|
# Make sure running the tests with random seed 3 gets the same
|
||||||
# order as in iteration 3 above. Success means that Google Test
|
# order as in iteration 3 above. Success means that Google Test
|
||||||
# correctly restores the test order before re-shuffling at the
|
# correctly restores the test order before re-shuffling at the
|
||||||
# beginning of iteration 3.
|
# beginning of iteration 3.
|
||||||
[tests_with_seed3] = GetTestsForAllIterations(
|
tests_with_seed3 = GetTestsForAllIterations(
|
||||||
{}, [ShuffleFlag(), RandomSeedFlag(3)])
|
{}, [ShuffleFlag(), RandomSeedFlag(3)]
|
||||||
|
)[0]
|
||||||
self.assertEqual(tests_in_iteration3, tests_with_seed3)
|
self.assertEqual(tests_in_iteration3, tests_with_seed3)
|
||||||
|
|
||||||
def testShuffleGeneratesNewOrderInEachIteration(self):
|
def testShuffleGeneratesNewOrderInEachIteration(self):
|
||||||
|
# pylint: disable-next=unbalanced-tuple-unpacking
|
||||||
[tests_in_iteration1, tests_in_iteration2, tests_in_iteration3] = (
|
[tests_in_iteration1, tests_in_iteration2, tests_in_iteration3] = (
|
||||||
GetTestsForAllIterations(
|
GetTestsForAllIterations(
|
||||||
{}, [ShuffleFlag(), RandomSeedFlag(1), RepeatFlag(3)]))
|
{}, [ShuffleFlag(), RandomSeedFlag(1), RepeatFlag(3)]))
|
||||||
@ -319,15 +324,18 @@ class GTestShuffleUnitTest(gtest_test_utils.TestCase):
|
|||||||
def testShuffleShardedTestsPreservesPartition(self):
|
def testShuffleShardedTestsPreservesPartition(self):
|
||||||
# If we run M tests on N shards, the same M tests should be run in
|
# If we run M tests on N shards, the same M tests should be run in
|
||||||
# total, regardless of the random seeds used by the shards.
|
# total, regardless of the random seeds used by the shards.
|
||||||
[tests1] = GetTestsForAllIterations({TOTAL_SHARDS_ENV_VAR: '3',
|
tests1 = GetTestsForAllIterations(
|
||||||
SHARD_INDEX_ENV_VAR: '0'},
|
{TOTAL_SHARDS_ENV_VAR: '3', SHARD_INDEX_ENV_VAR: '0'},
|
||||||
[ShuffleFlag(), RandomSeedFlag(1)])
|
[ShuffleFlag(), RandomSeedFlag(1)],
|
||||||
[tests2] = GetTestsForAllIterations({TOTAL_SHARDS_ENV_VAR: '3',
|
)[0]
|
||||||
SHARD_INDEX_ENV_VAR: '1'},
|
tests2 = GetTestsForAllIterations(
|
||||||
[ShuffleFlag(), RandomSeedFlag(20)])
|
{TOTAL_SHARDS_ENV_VAR: '3', SHARD_INDEX_ENV_VAR: '1'},
|
||||||
[tests3] = GetTestsForAllIterations({TOTAL_SHARDS_ENV_VAR: '3',
|
[ShuffleFlag(), RandomSeedFlag(20)],
|
||||||
SHARD_INDEX_ENV_VAR: '2'},
|
)[0]
|
||||||
[ShuffleFlag(), RandomSeedFlag(25)])
|
tests3 = GetTestsForAllIterations(
|
||||||
|
{TOTAL_SHARDS_ENV_VAR: '3', SHARD_INDEX_ENV_VAR: '2'},
|
||||||
|
[ShuffleFlag(), RandomSeedFlag(25)],
|
||||||
|
)[0]
|
||||||
sorted_sharded_tests = tests1 + tests2 + tests3
|
sorted_sharded_tests = tests1 + tests2 + tests3
|
||||||
sorted_sharded_tests.sort()
|
sorted_sharded_tests.sort()
|
||||||
sorted_active_tests = []
|
sorted_active_tests = []
|
||||||
|
Loading…
x
Reference in New Issue
Block a user