Replace assertItemsEqual with assertCountEqual
assertItemsEqual was removed from Python's unittest.TestCase in Python 3.3 [1][2]. We have been able to use them since then, because testtools required unittest2, which still included it. With testtools removing Python 2.7 support [3][4], we will lose support for assertItemsEqual, so we should switch to use assertCountEqual. [1] - https://bugs.python.org/issue17866 [2] - https://hg.python.org/cpython/rev/d9921cb6e3cd [3] - testing-cabal/testtools#286 [4] - testing-cabal/testtools#277 Change-Id: I0247031614ae75c1fd9f93898b7fb57838eb593f
This commit is contained in:
parent
43a20b4f1b
commit
29fe21adc4
|
@ -73,7 +73,7 @@ class TestRestAPI(base.TestCase):
|
|||
u'project',
|
||||
u'build_uuid'
|
||||
]
|
||||
self.assertItemsEqual(expected_response,
|
||||
self.assertCountEqual(expected_response,
|
||||
json.loads(res.data.decode('utf-8')))
|
||||
|
||||
@mock.patch('subunit2sql.db.api.get_test_run_dict_by_run_meta_key_value',
|
||||
|
|
|
@ -130,11 +130,11 @@ class TestRunAggregatorGetNumericData(base.TestCase):
|
|||
|
||||
}
|
||||
actual = run_aggregator.get_numeric_data(self.runs, 'day')
|
||||
self.assertItemsEqual(expected, actual)
|
||||
self.assertItemsEqual(
|
||||
self.assertCountEqual(expected, actual)
|
||||
self.assertCountEqual(
|
||||
expected['tempest-dsvm-neutron-full'].keys(),
|
||||
actual['tempest-dsvm-neutron-full'].keys())
|
||||
self.assertItemsEqual(
|
||||
self.assertCountEqual(
|
||||
expected['tempest-dsvm-neutron-full-avg'].keys(),
|
||||
actual['tempest-dsvm-neutron-full-avg'].keys())
|
||||
# np.nan == np.nan is False, remove the key entries with np.nan values,
|
||||
|
@ -180,11 +180,11 @@ class TestRunAggregatorGetNumericData(base.TestCase):
|
|||
}
|
||||
}
|
||||
actual = run_aggregator.get_numeric_data(self.runs, 'day')
|
||||
self.assertItemsEqual(expected, actual)
|
||||
self.assertItemsEqual(
|
||||
self.assertCountEqual(expected, actual)
|
||||
self.assertCountEqual(
|
||||
expected['tempest-dsvm-neutron-full'].keys(),
|
||||
actual['tempest-dsvm-neutron-full'].keys())
|
||||
self.assertItemsEqual(
|
||||
self.assertCountEqual(
|
||||
expected['tempest-dsvm-neutron-full-avg'].keys(),
|
||||
actual['tempest-dsvm-neutron-full-avg'].keys())
|
||||
# np.nan == np.nan is False, remove the key entries with np.nan values,
|
||||
|
@ -246,7 +246,7 @@ class TestRunAggregator(base.TestCase):
|
|||
}
|
||||
}
|
||||
|
||||
self.assertItemsEqual(expected_response, aggregated_runs)
|
||||
self.assertCountEqual(expected_response, aggregated_runs)
|
||||
|
||||
def test_that_runs_will_be_aggregated_by_minute_and_project(self):
|
||||
aggregator = run_aggregator.RunAggregator(self.runs)
|
||||
|
@ -263,7 +263,7 @@ class TestRunAggregator(base.TestCase):
|
|||
]
|
||||
}
|
||||
}
|
||||
self.assertItemsEqual(expected_response, aggregated_runs)
|
||||
self.assertCountEqual(expected_response, aggregated_runs)
|
||||
|
||||
def test_that_runs_will_be_aggregated_by_hour_and_project(self):
|
||||
aggregator = run_aggregator.RunAggregator(self.runs)
|
||||
|
@ -280,7 +280,7 @@ class TestRunAggregator(base.TestCase):
|
|||
]
|
||||
}
|
||||
}
|
||||
self.assertItemsEqual(expected_response, aggregated_runs)
|
||||
self.assertCountEqual(expected_response, aggregated_runs)
|
||||
|
||||
def test_that_runs_will_be_aggregated_by_day_and_project(self):
|
||||
aggregator = run_aggregator.RunAggregator(self.runs)
|
||||
|
@ -297,4 +297,4 @@ class TestRunAggregator(base.TestCase):
|
|||
]
|
||||
}
|
||||
}
|
||||
self.assertItemsEqual(expected_response, aggregated_runs)
|
||||
self.assertCountEqual(expected_response, aggregated_runs)
|
||||
|
|
|
@ -55,7 +55,7 @@ class TestTestRunAggregator(base.TestCase):
|
|||
}
|
||||
}
|
||||
|
||||
self.assertItemsEqual(expected_response, aggregated_test_runs)
|
||||
self.assertCountEqual(expected_response, aggregated_test_runs)
|
||||
expected_sahara_test = (expected_response['2015-01-02T12:23:56']
|
||||
['sahara_test'])
|
||||
actual_sahara_test = (aggregated_test_runs['2015-01-02T12:23:56']
|
||||
|
@ -92,7 +92,7 @@ class TestTestRunAggregator(base.TestCase):
|
|||
}
|
||||
}
|
||||
|
||||
self.assertItemsEqual(expected_response, aggregated_test_runs)
|
||||
self.assertCountEqual(expected_response, aggregated_test_runs)
|
||||
expected_sahara_test = (expected_response['2015-01-02T12:23:00']
|
||||
['sahara_test'])
|
||||
actual_sahara_test = (aggregated_test_runs['2015-01-02T12:23:00']
|
||||
|
@ -129,7 +129,7 @@ class TestTestRunAggregator(base.TestCase):
|
|||
}
|
||||
}
|
||||
|
||||
self.assertItemsEqual(expected_response, aggregated_test_runs)
|
||||
self.assertCountEqual(expected_response, aggregated_test_runs)
|
||||
expected_sahara_test = (expected_response['2015-01-02T12:00:00']
|
||||
['sahara_test'])
|
||||
actual_sahara_test = (aggregated_test_runs['2015-01-02T12:00:00']
|
||||
|
@ -166,7 +166,7 @@ class TestTestRunAggregator(base.TestCase):
|
|||
}
|
||||
}
|
||||
|
||||
self.assertItemsEqual(expected_response, aggregated_test_runs)
|
||||
self.assertCountEqual(expected_response, aggregated_test_runs)
|
||||
expected_sahara_test = (expected_response['2015-01-02']
|
||||
['sahara_test'])
|
||||
actual_sahara_test = (aggregated_test_runs['2015-01-02']
|
||||
|
|
Loading…
Reference in New Issue