Reviewed: https://review.openstack.org/320359 Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=18234b713a5cd4127bac7198c8a31b6728d1a74a Submitter: Jenkins Branch: master
commit 18234b713a5cd4127bac7198c8a31b6728d1a74a Author: Oleg Bondarev <[email protected]> Date: Tue May 24 13:44:41 2016 +0300 Do not inherit test case classes from regular Neutron classes It's a bad practice itself and it may lead to errors during tests initialization. Please see bug for details. Closes-Bug: #1585149 Change-Id: I6d2bca0cf0120edabfcc185c575ca399baa4d42c ** Changed in: neutron Status: In Progress => Fix Released -- You received this bug notification because you are a member of Yahoo! Engineering Team, which is subscribed to neutron. https://bugs.launchpad.net/bugs/1585149 Title: Do not inherit test case classes from regular Neutron classes Status in neutron: Fix Released Bug description: It's a bad practice itself and it may lead to errors during tests initialization. Test case classes are initialized during test loading stage by testing framework. Some neutron classes may not be ready to be created at this stage, for example those requiring rpc messaging system to be initialized first. I faced this bug after I added an rpc notifier to AgentDBMixin: unit tests started failing with: Traceback (most recent call last): File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main "__main__", fname, loader, pkg_name) File "/usr/lib/python2.7/runpy.py", line 72, in _run_code exec code in run_globals File "/home/obondarev/Neutron/neutron/.tox/py27/lib/python2.7/site-packages/subunit/run.py", line 149, in <module> main() File "/home/obondarev/Neutron/neutron/.tox/py27/lib/python2.7/site-packages/subunit/run.py", line 145, in main stdout=stdout, exit=False) File "/home/obondarev/Neutron/neutron/.tox/py27/local/lib/python2.7/site-packages/testtools/run.py", line 171, in __init__ self.parseArgs(argv) File "/home/obondarev/Neutron/neutron/.tox/py27/local/lib/python2.7/site-packages/unittest2/main.py", line 113, in parseArgs self._do_discovery(argv[2:]) File "/home/obondarev/Neutron/neutron/.tox/py27/local/lib/python2.7/site-packages/testtools/run.py", line 211, in _do_discovery super(TestProgram, self)._do_discovery(argv, Loader=Loader) File "/home/obondarev/Neutron/neutron/.tox/py27/local/lib/python2.7/site-packages/unittest2/main.py", line 223, in _do_discovery self.test = loader.discover(self.start, self.pattern, self.top) File "/home/obondarev/Neutron/neutron/.tox/py27/local/lib/python2.7/site-packages/unittest2/loader.py", line 374, in discover tests = list(self._find_tests(start_dir, pattern)) File "/home/obondarev/Neutron/neutron/.tox/py27/local/lib/python2.7/site-packages/unittest2/loader.py", line 440, in _find_tests for test in path_tests: File "/home/obondarev/Neutron/neutron/.tox/py27/local/lib/python2.7/site-packages/unittest2/loader.py", line 440, in _find_tests for test in path_tests: File "/home/obondarev/Neutron/neutron/.tox/py27/local/lib/python2.7/site-packages/unittest2/loader.py", line 431, in _find_tests full_path, pattern, namespace) File "/home/obondarev/Neutron/neutron/.tox/py27/local/lib/python2.7/site-packages/unittest2/loader.py", line 487, in _find_test_path return self.loadTestsFromModule(module, pattern=pattern), False File "/home/obondarev/Neutron/neutron/.tox/py27/local/lib/python2.7/site-packages/unittest2/loader.py", line 148, in loadTestsFromModule tests.append(self.loadTestsFromTestCase(obj)) File "/home/obondarev/Neutron/neutron/.tox/py27/local/lib/python2.7/site-packages/unittest2/loader.py", line 112, in loadTestsFromTestCase loaded_suite = self.suiteClass(map(testCaseClass, testCaseNames)) File "neutron/db/agents_db.py", line 190, in __init__ resources_rpc.ResourcesPushToServersRpcApi()) File "neutron/api/rpc/handlers/resources_rpc.py", line 135, in __init__ self.client = n_rpc.get_client(target) File "neutron/common/rpc.py", line 174, in get_client assert TRANSPORT is not None AssertionError To manage notifications about this bug go to: https://bugs.launchpad.net/neutron/+bug/1585149/+subscriptions -- Mailing list: https://launchpad.net/~yahoo-eng-team Post to : [email protected] Unsubscribe : https://launchpad.net/~yahoo-eng-team More help : https://help.launchpad.net/ListHelp

