From 415adbf4a2272e09fbd809b37819a21bdedf6861 Mon Sep 17 00:00:00 2001 From: Ihar Hrachyshka Date: Fri, 10 Apr 2015 11:29:56 +0200 Subject: [PATCH] tests: don't allow oslo.config to autodiscover config files oslo.config makes attempts to autodiscover configuration files using find_config_files() helper. If e.g. /etc/neutron/neutron.conf exists, and is not readable, the following test failure can be experienced: oslo_config.cfg.ConfigFilesPermissionDeniedError: Failed to open some config files: /etc/neutron/neutron.conf Unit tests must not rely on any external state of the system and run successfully no matter whether neutron is actually installed on the system, or not. Closes-Bug: #1442543 Change-Id: Ic90d8c40b2072fdda152703b84081719936b5f4e (cherry picked from commit 54fc39308277d4aedc3e399286714d719ecacfbb) --- neutron/tests/base.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/neutron/tests/base.py b/neutron/tests/base.py index e6e3f44cf..b3e4bc6b1 100644 --- a/neutron/tests/base.py +++ b/neutron/tests/base.py @@ -249,6 +249,10 @@ class BaseTestCase(DietTestCase): 'neutron.common.exceptions.NeutronException.use_fatal_exceptions', fake_use_fatal_exceptions)) + self.useFixture(fixtures.MonkeyPatch( + 'oslo_config.cfg.find_config_files', + lambda project=None, prog=None, extension=None: [])) + self.setup_rpc_mocks() self.setup_config() -- 2.45.2