Use keystoneauth only in applicable test

keystoneauth uses os-service-types as a run time dependency.
os-service-types uses keystoneauth as a testing dependency. This causes
an issue for packagers: in order to run the unit tests at build time,
an os-service-types package must include keystoneauth as a build
dependency, but since keystoneauth includes os-service-types as a run
time dependency, it causes a circular dependency.

To make it easier on packagers, this patch changes the usage of
keystoneauth in the tests to only be used by the TestRemote class
instead of the base TestCase class. This way, a packager could avoid
including keystoneauth as a build dependency by choosing to skip just
the problematic os-service-types test instead of skipping the entire
test suite.

Change-Id: I7f8da9c09f20ae808e1dc7aef2341396d91e7cf4
This commit is contained in:
Colleen Murphy 2018-09-05 11:25:11 +02:00
parent 2e5b38088a
commit 93729fcfcf
2 changed files with 4 additions and 4 deletions

View File

@ -18,7 +18,6 @@
import copy
import datetime
import keystoneauth1.session
from oslotest import base
import os_service_types.service_types
@ -30,9 +29,6 @@ class TestCase(base.BaseTestCase):
def setUp(self):
super(TestCase, self).setUp()
# use keystoneauth1 to get a Sessiom with no auth information
self.session = keystoneauth1.session.Session()
self.builtin_content = os_service_types.service_types.BUILTIN_DATA
self.builtin_version = self.builtin_content['version']

View File

@ -24,6 +24,8 @@ available in these tests.
from requests_mock.contrib import fixture as rm_fixture
from testscenarios import load_tests_apply_scenarios as load_tests # noqa
import keystoneauth1.session
import os_service_types
import os_service_types.service_types
from os_service_types.tests import base
@ -39,6 +41,8 @@ class TestRemote(base.TestCase, base.ServiceDataMixin):
'GET', os_service_types.service_types.SERVICE_TYPES_URL,
json=self.remote_content,
headers={'etag': self.getUniqueString('etag')})
# use keystoneauth1 to get a Sessiom with no auth information
self.session = keystoneauth1.session.Session()
# Make an object that fetches from the network
self.service_types = os_service_types.ServiceTypes(
session=self.session)