From 488b40834f84ca63c0ae3675313a5f32bbcd692a Mon Sep 17 00:00:00 2001 From: Bob Haddleton Date: Tue, 9 Oct 2018 11:21:23 -0500 Subject: [PATCH] Update version.version_string to actually be a string pbr provides VersionInfo.version_string() as a method to determine the version. mistral.version.version_string can hide this and provide a uniform string interface to config and launch. This fixes a problem with mistral-server --version generating an exception because the version passed to argparse was a method instead of a string. Change-Id: Ie468685e4360bfaec5d82b02f8cf1a27a93bcd94 Closes-Bug: 1796921 --- mistral/cmd/launch.py | 2 +- mistral/tests/unit/test_version.py | 19 +++++++++++++++++++ mistral/version.py | 2 +- 3 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 mistral/tests/unit/test_version.py diff --git a/mistral/cmd/launch.py b/mistral/cmd/launch.py index b6b159722..ec79816ae 100644 --- a/mistral/cmd/launch.py +++ b/mistral/cmd/launch.py @@ -143,7 +143,7 @@ MISTRAL_TITLE = """ || || || __// ||_// || \\\__// \\\_ || Mistral Workflow Service, version %s -""" % version.version_string() +""" % version.version_string def print_server_info(): diff --git a/mistral/tests/unit/test_version.py b/mistral/tests/unit/test_version.py new file mode 100644 index 000000000..676fa8d67 --- /dev/null +++ b/mistral/tests/unit/test_version.py @@ -0,0 +1,19 @@ +# 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 mistral.tests.unit import base +from mistral.version import version_string + + +class VersionStringTest(base.BaseTest): + def test_version(self): + self.assertIsInstance(version_string, str) diff --git a/mistral/version.py b/mistral/version.py index 892b7b9ee..40ba471c7 100644 --- a/mistral/version.py +++ b/mistral/version.py @@ -15,4 +15,4 @@ from pbr import version version_info = version.VersionInfo('mistral') -version_string = version_info.version_string +version_string = version_info.version_string()