Fix the gate

Following PyCQA/astroid@206d8a2 we sarted getting a whole bunch of
errors like

    E:266,44: Value 'headers' doesn't support membership test

and

    E:267,25: Value 'headers' is unsubscriptable

Digging around a bit, apparently astroid thinks the headers returned
from call_app will always be None -- I guess it doesn't like our use of
a list to work around py2's lack of `nonlocal`.

By using a proper object to encapsulate state, we can shut up those
"error"s.

Also, pin upper-constraints to pike for keystone-related jobs.

Change-Id: I5ff21260872f4089b030cd94e494dc346ae74b8e
This commit is contained in:
Tim Burke 2018-03-27 19:10:35 +00:00
parent 520b888834
commit b3efa1465c
2 changed files with 12 additions and 10 deletions

View File

@ -118,14 +118,16 @@ class Swift3TestCase(unittest.TestCase):
req.headers.setdefault("User-Agent", "Mozzarella Foxfire")
status = [None]
headers = [None]
class StartResponseContext(object):
status = headers = None
def start_response(s, h, ei=None):
status[0] = s
headers[0] = swob.HeaderKeyDict(h)
def __call__(self, s, h, ei=None):
self.status = s
self.headers = swob.HeaderKeyDict(h)
body_iter = app(req.environ, start_response)
sr = StartResponseContext()
body_iter = app(req.environ, sr)
body = ''
caught_exc = None
try:
@ -138,9 +140,9 @@ class Swift3TestCase(unittest.TestCase):
raise
if expect_exception:
return status[0], headers[0], body, caught_exc
return sr.status, sr.headers, body, caught_exc
else:
return status[0], headers[0], body
return sr.status, sr.headers, body
def call_swift3(self, req, **kwargs):
return self.call_app(req, app=self.swift3, **kwargs)

View File

@ -32,6 +32,7 @@ setenv = {[testenv]setenv}
commands = /bin/bash {posargs:swift3/test/functional/run_test.sh}
setenv = {[testenv]setenv}
AUTH=keystone
UPPER_CONSTRAINTS_FILE=https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=stable/pike
# keystone 12.0.0 (pike) from openstack.org
deps =
{[testenv]deps}
@ -63,8 +64,7 @@ setenv = {[testenv]setenv}
[testenv:s3tests_keystone]
commands = /bin/bash {posargs:swift3/test/functional/run_test.sh}
setenv = {[testenv]setenv}
AUTH=keystone
setenv = {[testenv:keystone]setenv}
S3ACL=true
DNS_BUCKET_NAMES=false
CHECK_BUCKET_OWNER=true