Move tests in keystoneclient
This is the suggested location for tests and is adopted by most projects. As part of this change relative imports to package imports. Fix all the test running and coverage code to point to the new location. Change-Id: I01264aed14f396ab9a7242e3e72b71e1bc332675
This commit is contained in:
parent
7f0df0ab4c
commit
0a18d8bbdf
.coveragerc.testr.conf
keystoneclient/tests
__init__.py
run_tests.shapiclient
client_fixtures.pyfakes.pytest_auth_token_middleware.pytest_base.pytest_ec2utils.pytest_http.pytest_https.pytest_keyring.pytest_memcache_crypt.pytest_shell.pytest_utils.pyutils.pyv2_0
__init__.pyclient_fixtures.pyfakes.pytest_access.pytest_auth.pytest_client.pytest_discovery.pytest_ec2.pytest_endpoints.pytest_roles.pytest_service_catalog.pytest_services.pytest_shell.pytest_tenants.pytest_tokens.pytest_users.pyutils.py
v3
@ -1,7 +1,7 @@
|
||||
[run]
|
||||
branch = True
|
||||
source = keystoneclient
|
||||
omit = keystoneclient/openstack/*
|
||||
omit = keystoneclient/tests/*,keystoneclient/openstack/*
|
||||
|
||||
[report]
|
||||
ignore-errors = True
|
||||
|
@ -1,4 +1,4 @@
|
||||
[DEFAULT]
|
||||
test_command=${PYTHON:-python} -m subunit.run discover -t ./ ./tests $LISTOPT $IDOPTION
|
||||
test_command=${PYTHON:-python} -m subunit.run discover -t ./ ./keystoneclient/tests $LISTOPT $IDOPTION
|
||||
test_id_option=--load-list $IDFILE
|
||||
test_list_option=--list
|
||||
|
@ -13,9 +13,8 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from tests import utils
|
||||
|
||||
from keystoneclient.apiclient import exceptions
|
||||
from keystoneclient.tests import utils
|
||||
|
||||
|
||||
class FakeResponse(object):
|
@ -22,9 +22,10 @@ from keystoneclient.openstack.common import timeutils
|
||||
from keystoneclient import utils
|
||||
|
||||
|
||||
ROOTDIR = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
|
||||
CERTDIR = os.path.join(ROOTDIR, "examples/pki/certs")
|
||||
CMSDIR = os.path.join(ROOTDIR, "examples/pki/cms")
|
||||
CLIENTDIR = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
|
||||
ROOTDIR = os.path.dirname(CLIENTDIR)
|
||||
CERTDIR = os.path.join(ROOTDIR, 'examples', 'pki', 'certs')
|
||||
CMSDIR = os.path.join(ROOTDIR, 'examples', 'pki', 'cms')
|
||||
|
||||
|
||||
# @TODO(mordred) This should become a testresources resource attached to the
|
@ -34,8 +34,8 @@ from keystoneclient.middleware import auth_token
|
||||
from keystoneclient.openstack.common import jsonutils
|
||||
from keystoneclient.openstack.common import memorycache
|
||||
from keystoneclient.openstack.common import timeutils
|
||||
from keystoneclient.tests import client_fixtures
|
||||
|
||||
import client_fixtures
|
||||
|
||||
EXPECTED_V2_DEFAULT_ENV_RESPONSE = {
|
||||
'HTTP_X_IDENTITY_STATUS': 'Confirmed',
|
@ -13,9 +13,9 @@
|
||||
# under the License.
|
||||
|
||||
from keystoneclient import base
|
||||
from keystoneclient.tests import utils
|
||||
from keystoneclient.v2_0 import client
|
||||
from keystoneclient.v2_0 import roles
|
||||
from tests import utils
|
||||
|
||||
|
||||
class HumanReadable(base.Resource):
|
@ -20,7 +20,7 @@ from testtools import matchers
|
||||
|
||||
from keystoneclient import exceptions
|
||||
from keystoneclient import httpclient
|
||||
from tests import utils
|
||||
from keystoneclient.tests import utils
|
||||
|
||||
RESPONSE_BODY = '{"hi": "there"}'
|
||||
|
@ -17,7 +17,7 @@ import mock
|
||||
import requests
|
||||
|
||||
from keystoneclient import httpclient
|
||||
from tests import utils
|
||||
from keystoneclient.tests import utils
|
||||
|
||||
FAKE_RESPONSE = utils.TestResponse({
|
||||
"status_code": 200,
|
@ -19,9 +19,8 @@ import mock
|
||||
from keystoneclient import access
|
||||
from keystoneclient import httpclient
|
||||
from keystoneclient.openstack.common import timeutils
|
||||
|
||||
from tests import utils
|
||||
from tests.v2_0 import client_fixtures
|
||||
from keystoneclient.tests import utils
|
||||
from keystoneclient.tests.v2_0 import client_fixtures
|
||||
|
||||
try:
|
||||
import keyring # noqa
|
@ -26,8 +26,9 @@ from testtools import matchers
|
||||
|
||||
from keystoneclient import exceptions
|
||||
from keystoneclient import shell as openstack_shell
|
||||
from keystoneclient.tests import utils
|
||||
from keystoneclient.v2_0 import shell as shell_v2_0
|
||||
from tests import utils
|
||||
|
||||
|
||||
DEFAULT_USERNAME = 'username'
|
||||
DEFAULT_PASSWORD = 'password'
|
@ -13,8 +13,8 @@
|
||||
# under the License.
|
||||
|
||||
from keystoneclient import exceptions
|
||||
from keystoneclient.tests import utils as test_utils
|
||||
from keystoneclient import utils
|
||||
from tests import utils as test_utils
|
||||
|
||||
|
||||
class FakeResource(object):
|
@ -15,8 +15,8 @@
|
||||
|
||||
import urlparse
|
||||
|
||||
from tests import fakes
|
||||
from tests.v2_0 import utils
|
||||
from keystoneclient.tests import fakes
|
||||
from keystoneclient.tests.v2_0 import utils
|
||||
|
||||
|
||||
class FakeHTTPClient(fakes.FakeClient):
|
@ -16,9 +16,9 @@ import datetime
|
||||
|
||||
from keystoneclient import access
|
||||
from keystoneclient.openstack.common import timeutils
|
||||
from tests import client_fixtures as token_data
|
||||
from tests.v2_0 import client_fixtures
|
||||
from tests.v2_0 import utils
|
||||
from keystoneclient.tests import client_fixtures as token_data
|
||||
from keystoneclient.tests.v2_0 import client_fixtures
|
||||
from keystoneclient.tests.v2_0 import utils
|
||||
|
||||
UNSCOPED_TOKEN = client_fixtures.UNSCOPED_TOKEN
|
||||
PROJECT_SCOPED_TOKEN = client_fixtures.PROJECT_SCOPED_TOKEN
|
@ -19,8 +19,8 @@ import httpretty
|
||||
|
||||
from keystoneclient import exceptions
|
||||
from keystoneclient.openstack.common import timeutils
|
||||
from keystoneclient.tests.v2_0 import utils
|
||||
from keystoneclient.v2_0 import client
|
||||
from tests.v2_0 import utils
|
||||
|
||||
|
||||
class AuthenticateAgainstKeystoneTests(utils.TestCase):
|
@ -17,9 +17,9 @@ import json
|
||||
import httpretty
|
||||
|
||||
from keystoneclient import exceptions
|
||||
from keystoneclient.tests.v2_0 import client_fixtures
|
||||
from keystoneclient.tests.v2_0 import utils
|
||||
from keystoneclient.v2_0 import client
|
||||
from tests.v2_0 import client_fixtures
|
||||
from tests.v2_0 import utils
|
||||
|
||||
|
||||
class KeystoneClientTest(utils.TestCase):
|
@ -15,7 +15,7 @@
|
||||
import httpretty
|
||||
|
||||
from keystoneclient.generic import client
|
||||
from tests.v2_0 import utils
|
||||
from keystoneclient.tests.v2_0 import utils
|
||||
|
||||
|
||||
class DiscoverKeystoneTests(utils.UnauthenticatedTestCase):
|
@ -14,8 +14,8 @@
|
||||
|
||||
import httpretty
|
||||
|
||||
from keystoneclient.tests.v2_0 import utils
|
||||
from keystoneclient.v2_0 import ec2
|
||||
from tests.v2_0 import utils
|
||||
|
||||
|
||||
class EC2Tests(utils.TestCase):
|
@ -14,8 +14,8 @@
|
||||
|
||||
import httpretty
|
||||
|
||||
from keystoneclient.tests.v2_0 import utils
|
||||
from keystoneclient.v2_0 import endpoints
|
||||
from tests.v2_0 import utils
|
||||
|
||||
|
||||
class EndpointTests(utils.TestCase):
|
@ -14,8 +14,8 @@
|
||||
|
||||
import httpretty
|
||||
|
||||
from keystoneclient.tests.v2_0 import utils
|
||||
from keystoneclient.v2_0 import roles
|
||||
from tests.v2_0 import utils
|
||||
|
||||
|
||||
class RoleTests(utils.TestCase):
|
@ -16,9 +16,8 @@ import copy
|
||||
|
||||
from keystoneclient import access
|
||||
from keystoneclient import exceptions
|
||||
|
||||
from tests.v2_0 import client_fixtures
|
||||
from tests.v2_0 import utils
|
||||
from keystoneclient.tests.v2_0 import client_fixtures
|
||||
from keystoneclient.tests.v2_0 import utils
|
||||
|
||||
|
||||
class ServiceCatalogTest(utils.TestCase):
|
@ -14,8 +14,8 @@
|
||||
|
||||
import httpretty
|
||||
|
||||
from keystoneclient.tests.v2_0 import utils
|
||||
from keystoneclient.v2_0 import services
|
||||
from tests.v2_0 import utils
|
||||
|
||||
|
||||
class ServiceTests(utils.TestCase):
|
@ -20,9 +20,8 @@ from mox3 import stubout
|
||||
from testtools import matchers
|
||||
|
||||
from keystoneclient import httpclient
|
||||
|
||||
from tests.v2_0 import fakes
|
||||
from tests.v2_0 import utils
|
||||
from keystoneclient.tests.v2_0 import fakes
|
||||
from keystoneclient.tests.v2_0 import utils
|
||||
|
||||
|
||||
DEFAULT_USERNAME = 'username'
|
@ -15,8 +15,8 @@
|
||||
import httpretty
|
||||
|
||||
from keystoneclient import exceptions
|
||||
from keystoneclient.tests.v2_0 import utils
|
||||
from keystoneclient.v2_0 import tenants
|
||||
from tests.v2_0 import utils
|
||||
|
||||
|
||||
class TenantTests(utils.TestCase):
|
@ -14,7 +14,7 @@
|
||||
|
||||
import httpretty
|
||||
|
||||
from tests.v2_0 import utils
|
||||
from keystoneclient.tests.v2_0 import utils
|
||||
|
||||
|
||||
class TokenTests(utils.TestCase):
|
@ -14,8 +14,8 @@
|
||||
|
||||
import httpretty
|
||||
|
||||
from keystoneclient.tests.v2_0 import utils
|
||||
from keystoneclient.v2_0 import users
|
||||
from tests.v2_0 import utils
|
||||
|
||||
|
||||
class UserTests(utils.TestCase):
|
@ -14,8 +14,8 @@
|
||||
|
||||
import httpretty
|
||||
|
||||
from keystoneclient.tests import utils
|
||||
from keystoneclient.v2_0 import client
|
||||
from tests import utils
|
||||
|
||||
TestResponse = utils.TestResponse
|
||||
|
@ -16,8 +16,8 @@ import datetime
|
||||
|
||||
from keystoneclient import access
|
||||
from keystoneclient.openstack.common import timeutils
|
||||
from tests.v3 import client_fixtures
|
||||
from tests.v3 import utils
|
||||
from keystoneclient.tests.v3 import client_fixtures
|
||||
from keystoneclient.tests.v3 import utils
|
||||
|
||||
TOKEN_RESPONSE = utils.TestResponse({
|
||||
"headers": client_fixtures.AUTH_RESPONSE_HEADERS
|
@ -15,10 +15,9 @@
|
||||
import httpretty
|
||||
|
||||
from keystoneclient import exceptions
|
||||
from keystoneclient.tests.v3 import utils
|
||||
from keystoneclient.v3 import client
|
||||
|
||||
from tests.v3 import utils
|
||||
|
||||
|
||||
class AuthenticateAgainstKeystoneTests(utils.TestCase):
|
||||
def setUp(self):
|
@ -17,11 +17,10 @@ import json
|
||||
import httpretty
|
||||
|
||||
from keystoneclient import exceptions
|
||||
from keystoneclient.tests.v3 import client_fixtures
|
||||
from keystoneclient.tests.v3 import utils
|
||||
from keystoneclient.v3 import client
|
||||
|
||||
from tests.v3 import client_fixtures
|
||||
from tests.v3 import utils
|
||||
|
||||
|
||||
class KeystoneClientTest(utils.TestCase):
|
||||
|
@ -14,8 +14,8 @@
|
||||
|
||||
import uuid
|
||||
|
||||
from keystoneclient.tests.v3 import utils
|
||||
from keystoneclient.v3 import credentials
|
||||
from tests.v3 import utils
|
||||
|
||||
|
||||
class CredentialTests(utils.TestCase, utils.CrudTests):
|
@ -17,7 +17,7 @@ import json
|
||||
import httpretty
|
||||
|
||||
from keystoneclient.generic import client
|
||||
from tests.v3 import utils
|
||||
from keystoneclient.tests.v3 import utils
|
||||
|
||||
|
||||
class DiscoverKeystoneTests(utils.UnauthenticatedTestCase):
|
@ -14,8 +14,8 @@
|
||||
|
||||
import uuid
|
||||
|
||||
from keystoneclient.tests.v3 import utils
|
||||
from keystoneclient.v3 import domains
|
||||
from tests.v3 import utils
|
||||
|
||||
|
||||
class DomainTests(utils.TestCase, utils.CrudTests):
|
@ -14,8 +14,8 @@
|
||||
|
||||
import uuid
|
||||
|
||||
from keystoneclient.tests.v3 import utils
|
||||
from keystoneclient.v3 import endpoints
|
||||
from tests.v3 import utils
|
||||
|
||||
|
||||
class EndpointTests(utils.TestCase, utils.CrudTests):
|
@ -18,8 +18,8 @@ import uuid
|
||||
|
||||
import httpretty
|
||||
|
||||
from keystoneclient.tests.v3 import utils
|
||||
from keystoneclient.v3 import groups
|
||||
from tests.v3 import utils
|
||||
|
||||
|
||||
class GroupTests(utils.TestCase, utils.CrudTests):
|
@ -14,8 +14,8 @@
|
||||
|
||||
import uuid
|
||||
|
||||
from keystoneclient.tests.v3 import utils
|
||||
from keystoneclient.v3 import policies
|
||||
from tests.v3 import utils
|
||||
|
||||
|
||||
class PolicyTests(utils.TestCase, utils.CrudTests):
|
@ -16,8 +16,8 @@ import uuid
|
||||
|
||||
import httpretty
|
||||
|
||||
from keystoneclient.tests.v3 import utils
|
||||
from keystoneclient.v3 import projects
|
||||
from tests.v3 import utils
|
||||
|
||||
|
||||
class ProjectTests(utils.TestCase, utils.CrudTests):
|
@ -19,8 +19,8 @@ import uuid
|
||||
import httpretty
|
||||
|
||||
from keystoneclient import exceptions
|
||||
from keystoneclient.tests.v3 import utils
|
||||
from keystoneclient.v3 import roles
|
||||
from tests.v3 import utils
|
||||
|
||||
|
||||
class RoleTests(utils.TestCase, utils.CrudTests):
|
@ -16,9 +16,8 @@ import copy
|
||||
|
||||
from keystoneclient import access
|
||||
from keystoneclient import exceptions
|
||||
|
||||
from tests.v3 import client_fixtures
|
||||
from tests.v3 import utils
|
||||
from keystoneclient.tests.v3 import client_fixtures
|
||||
from keystoneclient.tests.v3 import utils
|
||||
|
||||
|
||||
class ServiceCatalogTest(utils.TestCase):
|
@ -14,8 +14,8 @@
|
||||
|
||||
import uuid
|
||||
|
||||
from keystoneclient.tests.v3 import utils
|
||||
from keystoneclient.v3 import services
|
||||
from tests.v3 import utils
|
||||
|
||||
|
||||
class ServiceTests(utils.TestCase, utils.CrudTests):
|
@ -17,8 +17,8 @@ import uuid
|
||||
|
||||
from keystoneclient import exceptions
|
||||
from keystoneclient.openstack.common import timeutils
|
||||
from keystoneclient.tests.v3 import utils
|
||||
from keystoneclient.v3.contrib import trusts
|
||||
from tests.v3 import utils
|
||||
|
||||
|
||||
class TrustTests(utils.TestCase, utils.CrudTests):
|
@ -19,8 +19,8 @@ import uuid
|
||||
import httpretty
|
||||
|
||||
from keystoneclient import exceptions
|
||||
from keystoneclient.tests.v3 import utils
|
||||
from keystoneclient.v3 import users
|
||||
from tests.v3 import utils
|
||||
|
||||
|
||||
class UserTests(utils.TestCase, utils.CrudTests):
|
@ -18,10 +18,9 @@ import uuid
|
||||
import httpretty
|
||||
|
||||
from keystoneclient.openstack.common import jsonutils
|
||||
from keystoneclient.tests import utils
|
||||
from keystoneclient.v3 import client
|
||||
|
||||
from tests import utils
|
||||
|
||||
TestResponse = utils.TestResponse
|
||||
|
||||
|
@ -81,7 +81,7 @@ function run_tests {
|
||||
if [ "$testropts" = "" ] && [ "$testrargs" = "" ]; then
|
||||
# Default to running all tests if specific test is not
|
||||
# provided.
|
||||
testrargs="discover ./tests"
|
||||
testrargs="discover ./keystoneclient/tests"
|
||||
fi
|
||||
${wrapper} python -m testtools.run $testropts $testrargs
|
||||
|
||||
@ -112,7 +112,7 @@ function run_tests {
|
||||
echo "Generating coverage report in covhtml/"
|
||||
# Don't compute coverage for common code, which is tested elsewhere
|
||||
${wrapper} coverage combine
|
||||
${wrapper} coverage html --include='keystoneclient/*' --omit='keystoneclient/openstack/common/*' -d covhtml -i
|
||||
${wrapper} coverage html -d covhtml -i
|
||||
fi
|
||||
|
||||
return $RESULT
|
||||
@ -127,7 +127,7 @@ function copy_subunit_log {
|
||||
|
||||
function run_flake8 {
|
||||
echo "Running flake8 ..."
|
||||
srcfiles="keystoneclient tests"
|
||||
srcfiles="keystoneclient"
|
||||
# Just run Flake8 in current environment
|
||||
${wrapper} flake8 ${srcfiles}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user