]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commit
tests: monkey patch stdlib before importing other modules
authorIhar Hrachyshka <ihrachys@redhat.com>
Thu, 5 Feb 2015 13:21:38 +0000 (14:21 +0100)
committerIhar Hrachyshka <ihrachys@redhat.com>
Wed, 18 Feb 2015 12:33:57 +0000 (13:33 +0100)
commitea76d10e7492eb90f6777940304c67691caa366b
tree84d9412a852d9b06dce91abc61fc6f3b18325276
parent81ea614570397fbe0722060d3faa703e7ded9151
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.

Closes-Bug: #1418541
Change-Id: Id58409000d0e086f3fb664a15935af4f1708c396
neutron/tests/__init__.py
neutron/tests/functional/agent/linux/simple_daemon.py