Fix relative path for default templates

After installing package we have a problem with running tests
from default templates.
closes-bug: 1569826

Co-Authored-By: Luigi Toscano <ltoscano@redhat.com>

Change-Id: I879c63b65b6f89a77acd672eea9d1c16d42f1a1b
This commit is contained in:
Evgeny Sikachev 2016-04-19 10:51:34 +02:00 committed by Luigi Toscano
parent baf526ef90
commit 53e7d377dd
3 changed files with 32 additions and 2 deletions

View File

@ -0,0 +1,6 @@
---
prelude: >
Fix default resource discovery from the installed package.
fixes:
- The default set of resources (test templates for each plugin, etc)
can now be properly discovered when the package is installed.

View File

@ -25,18 +25,24 @@ import tempfile
from mako import template as mako_template
from oslo_utils import fileutils
import pkg_resources as pkg
import six
import yaml
from sahara_tests.scenario import validation
from sahara_tests import version
TEST_TEMPLATE_DIR = 'sahara_tests/scenario/defaults/'
SCENARIO_RESOURCES_DIR = pkg.resource_filename(version.version_info.package,
'scenario')
TEST_TEMPLATE_DIR = os.path.join(SCENARIO_RESOURCES_DIR, 'defaults/')
DEFAULT_TEMPLATE_VARS = [os.path.join(TEST_TEMPLATE_DIR,
'credentials.yaml.mako'),
os.path.join(TEST_TEMPLATE_DIR,
'edp.yaml.mako')]
TEST_TEMPLATE_PATH = 'sahara_tests/scenario/testcase.py.mako'
TEST_TEMPLATE_PATH = os.path.join(SCENARIO_RESOURCES_DIR,
'testcase.py.mako')
def set_defaults(config):

18
sahara_tests/version.py Normal file
View File

@ -0,0 +1,18 @@
# Copyright (c) 2016 Mirantis Inc.
#
# 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.
from pbr import version
version_info = version.VersionInfo('sahara_tests')