Including tests/ in pep8

This commit is contained in:
Rick Harris 2011-02-05 01:40:39 -06:00
parent dc20f62ef0
commit 19d9a5d991
4 changed files with 25 additions and 20 deletions

View File

@ -79,4 +79,5 @@ fi
#
PEP8_EXCLUDE=vcsversion.py
PEP8_OPTIONS="--exclude=$PEP8_EXCLUDE --repeat --show-pep8 --show-source"
run_tests && pep8 $PEP8_OPTIONS bin/* glance setup.py run_tests.py || exit 1
PEP8_INCLUDE="bin/* glance tests tools setup.py run_tests.py"
run_tests && pep8 $PEP8_OPTIONS $PEP8_INCLUDE || exit 1

View File

@ -40,6 +40,7 @@ import glance.registry.db.api
FAKE_FILESYSTEM_ROOTDIR = os.path.join('/tmp', 'glance-tests')
VERBOSE = False
def stub_out_http_backend(stubs):
"""Stubs out the httplib.HTTPRequest.getresponse to return
faked-out data instead of grabbing actual contents of a resource
@ -239,8 +240,8 @@ def stub_out_registry_and_store_server(stubs):
self.req.body = body
def getresponse(self):
res = self.req.get_response(rserver.API({'sql_connection': 'sqlite://',
'verbose': VERBOSE}))
options = {'sql_connection': 'sqlite://', 'verbose': VERBOSE}
res = self.req.get_response(rserver.API(options))
# httplib.Response has a read() method...fake it out
def fake_reader():
@ -285,11 +286,12 @@ def stub_out_registry_and_store_server(stubs):
self.req.body = body
def getresponse(self):
res = self.req.get_response(server.API({'verbose': VERBOSE,
'registry_host': '0.0.0.0',
'registry_port': '9191',
'default_store': 'file',
'filesystem_store_datadir': FAKE_FILESYSTEM_ROOTDIR}))
options = {'verbose': VERBOSE,
'registry_host': '0.0.0.0',
'registry_port': '9191',
'default_store': 'file',
'filesystem_store_datadir': FAKE_FILESYSTEM_ROOTDIR}
res = self.req.get_response(server.API(options))
# httplib.Response has a read() method...fake it out
def fake_reader():

View File

@ -227,11 +227,12 @@ class TestGlanceAPI(unittest.TestCase):
stubs.stub_out_registry_and_store_server(self.stubs)
stubs.stub_out_registry_db_image_api(self.stubs)
stubs.stub_out_filesystem_backend()
self.api = server.API({'registry_host': '0.0.0.0',
'registry_port': '9191',
'sql_connection': 'sqlite://',
'default_store': 'file',
'filesystem_store_datadir': stubs.FAKE_FILESYSTEM_ROOTDIR})
options = {'registry_host': '0.0.0.0',
'registry_port': '9191',
'sql_connection': 'sqlite://',
'default_store': 'file',
'filesystem_store_datadir': stubs.FAKE_FILESYSTEM_ROOTDIR}
self.api = server.API(options)
def tearDown(self):
"""Clear the test environment"""

View File

@ -21,6 +21,7 @@ import unittest
import glance.registry.db.migration as migration_api
import glance.common.config as config
class TestMigrations(unittest.TestCase):
"""Test sqlalchemy-migrate migrations"""
@ -36,13 +37,13 @@ class TestMigrations(unittest.TestCase):
def test_db_sync_downgrade_then_upgrade(self):
migration_api.db_sync(self.options)
latest = migration_api.db_version(self.options)
migration_api.downgrade(self.options, latest-1)
cur_version = migration_api.db_version(self.options)
self.assertEqual(cur_version, latest-1)
migration_api.upgrade(self.options, cur_version+1)
latest = migration_api.db_version(self.options)
migration_api.downgrade(self.options, latest - 1)
cur_version = migration_api.db_version(self.options)
self.assertEqual(cur_version, latest - 1)
migration_api.upgrade(self.options, cur_version + 1)
cur_version = migration_api.db_version(self.options)
self.assertEqual(cur_version, latest)