tests: monkey patch stdlib before importing other modules
Some oslo libraries assume that stdlib is already patched when they are
imported (f.e. oslo.concurrency.processutils currently checks whether
time module is monkey patched on import to detect which subprocess
module should be used).
For services, we achieve this by moving monkey_patch() calls as high in
import list as possible. But for tests, we don't control the order in
which testr loads test cases. So to be on safe side, we should make sure
any attempt to load a test case from the tree results in eventlet patch.
We can't put the monkey_patch() call into e.g. neutron/__init__.py to
reuse it both for tests and for services, because in that case we may
break flake8 that loads hacking checks from neutron.* namespace and
relies on proper (unpatched) subprocess module.
Reviewed: https:/ /review. openstack. org/153225 /git.openstack. org/cgit/ openstack/ neutron/ commit/ ?id=ea76d10e749 2eb90f677794030 4c67691caa366b
Committed: https:/
Submitter: Jenkins
Branch: master
commit ea76d10e7492eb9 0f6777940304c67 691caa366b
Author: Ihar Hrachyshka <email address hidden>
Date: Thu Feb 5 14:21:38 2015 +0100
tests: monkey patch stdlib before importing other modules
Some oslo libraries assume that stdlib is already patched when they are y.processutils currently checks whether
imported (f.e. oslo.concurrenc
time module is monkey patched on import to detect which subprocess
module should be used).
For services, we achieve this by moving monkey_patch() calls as high in
import list as possible. But for tests, we don't control the order in
which testr loads test cases. So to be on safe side, we should make sure
any attempt to load a test case from the tree results in eventlet patch.
We can't put the monkey_patch() call into e.g. neutron/__init__.py to
reuse it both for tests and for services, because in that case we may
break flake8 that loads hacking checks from neutron.* namespace and
relies on proper (unpatched) subprocess module.
Closes-Bug: #1418541 6f3fb664a15935a f4f1708c396
Change-Id: Id58409000d0e08