diff options
author | Alistair Coles <alistair.coles@hpe.com> | 2016-02-19 09:30:10 +0000 |
---|---|---|
committer | Alistair Coles <alistair.coles@hpe.com> | 2016-02-24 14:41:28 +0000 |
commit | 54e53ae87b6e87229dc77cb7c814ab9733ea7013 (patch) | |
tree | d077fcfed7f89d64074e413b5222fffde8290d64 /test/functional/__init__.py | |
parent | ebe61381c27607adc212402fc64c3b7ae4fef27d (diff) | |
download | swift-54e53ae87b6e87229dc77cb7c814ab9733ea7013.tar.gz |
Silence SkipTest noise in in-process test teardown
setup_package and teardown_package get called twice when
running functional tests using nose. With in-process mode
the first call to teardown_package clears global config
which causes the test swiftclient to raise a SkipTest error
during the second call to teardown_package.
To reproduce:
SWIFT_TEST_IN_PROCESS=1 nosetests ./test/functional/test_account.py
This patch simply tests for config existence before attempting
to create a test swiftclient in the teardown_package function.
Also fix a related issue whereby in_process flag would be reset to
False during second call to setup_package, thus causing some of the
in process cleanup in teardown_package to never be executed.
Change-Id: I074dcd3d39aa46b262632024b047556ca471e8b8
Diffstat (limited to 'test/functional/__init__.py')
-rw-r--r-- | test/functional/__init__.py | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/test/functional/__init__.py b/test/functional/__init__.py index 1197f3f8d..52be849bf 100644 --- a/test/functional/__init__.py +++ b/test/functional/__init__.py @@ -577,10 +577,13 @@ def setup_package(): # if the test.conf file is not found, or does not provide a usable # configuration. config.update(get_config('func_test')) - if config: - in_process = False - else: + if not config: in_process = True + # else... leave in_process value unchanged. It may be that + # setup_package is called twice, in which case in_process_setup may + # have loaded config before we reach here a second time, so the + # existence of config is not reliable to determine that in_process + # should be False. Anyway, it's default value is False. else: # Explicitly set to False, do not attempt to use in-process # functional tests, be sure we attempt to read from local @@ -775,10 +778,12 @@ def teardown_package(): # clean up containers and objects left behind after running tests global config - conn = Connection(config) - conn.authenticate() - account = Account(conn, config.get('account', config['username'])) - account.delete_containers() + + if config: + conn = Connection(config) + conn.authenticate() + account = Account(conn, config.get('account', config['username'])) + account.delete_containers() global in_process global _test_socks |