diff options
author | 2017-09-16 16:13:09 +0000 | |
---|---|---|
committer | 2017-09-16 18:55:53 +0000 | |
commit | 44038eb9b630eafad57e30e09d021de8d68e94d5 (patch) | |
tree | a9431dbaed4a61592b7afa77e8d92955c2c657b9 /src/python/grpcio_tests/tests/unit/_sanity/_sanity_test.py | |
parent | 8d3cc5ff0c2b86bd6766944891c1706153135a47 (diff) |
Tweak Python sanity test
- Move it out of the "unit" package, as it's not itself a unit test.
- Suffix the test class with "Test" as we do with every other subclass
of unittest.TestCase.
- Add a larger-than-we'll-need-any-time-soon maxDiff so that failures
are fully described.
- Relax the assertion from assertListEqual to assertSequenceEqual
since we don't actually care whether or not the sequences being
compared are list instances.
- Change the order of the assertions arguments to match the
"<expected>, <actual>" convention used in our assert*Equal calls
elsewhere throughout the test corpus.
- Internal implementation simplifications.
Diffstat (limited to 'src/python/grpcio_tests/tests/unit/_sanity/_sanity_test.py')
-rw-r--r-- | src/python/grpcio_tests/tests/unit/_sanity/_sanity_test.py | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/src/python/grpcio_tests/tests/unit/_sanity/_sanity_test.py b/src/python/grpcio_tests/tests/unit/_sanity/_sanity_test.py deleted file mode 100644 index 19bc8801eb..0000000000 --- a/src/python/grpcio_tests/tests/unit/_sanity/_sanity_test.py +++ /dev/null @@ -1,45 +0,0 @@ -# Copyright 2016 gRPC authors. -# -# 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. - -import json -import unittest - -import pkg_resources -import six - -import tests - - -class Sanity(unittest.TestCase): - - def testTestsJsonUpToDate(self): - """Autodiscovers all test suites and checks that tests.json is up to date""" - loader = tests.Loader() - loader.loadTestsFromNames(['tests']) - test_suite_names = [ - test_case_class.id().rsplit('.', 1)[0] - for test_case_class in tests._loader.iterate_suite_cases( - loader.suite) - ] - test_suite_names = sorted(set(test_suite_names)) - - tests_json_string = pkg_resources.resource_string('tests', 'tests.json') - if six.PY3: - tests_json_string = tests_json_string.decode() - tests_json = json.loads(tests_json_string) - self.assertListEqual(test_suite_names, tests_json) - - -if __name__ == '__main__': - unittest.main(verbosity=2) |