Only change collation for functional tests
The unconditional module-level change of the locale collation can affect other tests run under nose. To avoid this, make the change at the package level, and restore it when finished. Change-Id: Iacda42aa7155f1cfa7d0dcadbf73b961dfb4b923
This commit is contained in:
parent
07fcf50c3a
commit
5ea6c88128
@ -0,0 +1,32 @@
|
||||
# Copyright (c) 2014 OpenStack Foundation
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import locale
|
||||
|
||||
|
||||
config = {}
|
||||
orig_collate = ''
|
||||
|
||||
|
||||
def setup_package():
|
||||
global orig_collate
|
||||
orig_collate = locale.setlocale(locale.LC_COLLATE)
|
||||
global config
|
||||
locale.setlocale(locale.LC_COLLATE, config.get('collate', 'C'))
|
||||
|
||||
|
||||
def teardown_package():
|
||||
global orig_collate
|
||||
locale.setlocale(locale.LC_COLLATE, orig_collate)
|
@ -29,12 +29,13 @@ import uuid
|
||||
from nose import SkipTest
|
||||
|
||||
from test import get_config
|
||||
from test.functional import config
|
||||
from test.functional.swift_test_client import Account, Connection, File, \
|
||||
ResponseError
|
||||
from swift.common import constraints
|
||||
|
||||
|
||||
config = get_config('func_test')
|
||||
config.update(get_config('func_test'))
|
||||
for k in constraints.DEFAULT_CONSTRAINTS:
|
||||
if k in config:
|
||||
# prefer what's in test.conf
|
||||
@ -60,8 +61,6 @@ def load_constraint(name):
|
||||
raise SkipTest(c)
|
||||
return c
|
||||
|
||||
locale.setlocale(locale.LC_COLLATE, config.get('collate', 'C'))
|
||||
|
||||
|
||||
def chunks(s, length=3):
|
||||
i, j = 0, length
|
||||
|
Loading…
Reference in New Issue
Block a user