Merge lp:~ken-pepple/nova/lp828600 into lp:~hudson-openstack/nova/trunk

Proposed by Ken Pepple
Status: Merged
Approved by: Brian Waldon
Approved revision: 1471
Merged at revision: 1484
Proposed branch: lp:~ken-pepple/nova/lp828600
Merge into: lp:~hudson-openstack/nova/trunk
Diff against target: 65 lines (+61/-0)
1 file modified
nova/tests/test_versions.py (+61/-0)
To merge this branch: bzr merge lp:~ken-pepple/nova/lp828600
Reviewer Review Type Date Requested Status
Trey Morris (community) Approve
Alex Meade (community) Approve
Brian Waldon (community) Approve
Review via email: mp+72319@code.launchpad.net

Commit message

added unit tests for version.py

Description of the change

added unit tests for version.py (although not like soren asked) by adding test_versions.py

Is the correct copyright ? we used to do it this way (claim copyright by primary author) but most files I see now are just "copyright 2011 Openstack LLC" ... not important to me either way just wanting to follow the rules.

To post a comment you must log in.
Revision history for this message
Brian Waldon (bcwaldon) wrote :

Good work, Ken.

review: Approve
Revision history for this message
Alex Meade (alex-meade) :
review: Approve
Revision history for this message
Trey Morris (tr3buchet) wrote :

even more good stuff

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'nova/tests/test_versions.py'
2--- nova/tests/test_versions.py 1970-01-01 00:00:00 +0000
3+++ nova/tests/test_versions.py 2011-08-21 01:33:24 +0000
4@@ -0,0 +1,61 @@
5+# vim: tabstop=4 shiftwidth=4 softtabstop=4
6+
7+# Copyright 2011 Ken Pepple
8+#
9+# Licensed under the Apache License, Version 2.0 (the "License"); you may
10+# not use this file except in compliance with the License. You may obtain
11+# a copy of the License at
12+#
13+# http://www.apache.org/licenses/LICENSE-2.0
14+#
15+# Unless required by applicable law or agreed to in writing, software
16+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
17+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
18+# License for the specific language governing permissions and limitations
19+# under the License.
20+
21+
22+from nova import exception
23+from nova import test
24+from nova import utils
25+from nova import version
26+
27+
28+class VersionTestCase(test.TestCase):
29+ """Test cases for Versions code"""
30+ def setUp(self):
31+ """setup test with unchanging values"""
32+ super(VersionTestCase, self).setUp()
33+ self.version = version
34+ self.version.FINAL = False
35+ self.version.NOVA_VERSION = ['2012', '10']
36+ self.version.YEAR, self.version.COUNT = self.version.NOVA_VERSION
37+ self.version.version_info = {'branch_nick': u'LOCALBRANCH',
38+ 'revision_id': 'LOCALREVISION',
39+ 'revno': 0}
40+
41+ def test_version_string_is_good(self):
42+ """Ensure version string works"""
43+ self.assertEqual("2012.10-dev", self.version.version_string())
44+
45+ def test_canonical_version_string_is_good(self):
46+ """Ensure canonical version works"""
47+ self.assertEqual("2012.10", self.version.canonical_version_string())
48+
49+ def test_final_version_strings_are_identical(self):
50+ """Ensure final version strings match only at release"""
51+ self.assertNotEqual(self.version.canonical_version_string(),
52+ self.version.version_string())
53+ self.version.FINAL = True
54+ self.assertEqual(self.version.canonical_version_string(),
55+ self.version.version_string())
56+
57+ def test_vcs_version_string_is_good(self):
58+ """Ensure uninstalled code generates local """
59+ self.assertEqual("LOCALBRANCH:LOCALREVISION",
60+ self.version.vcs_version_string())
61+
62+ def test_version_string_with_vcs_is_good(self):
63+ """Ensure uninstalled code get version string"""
64+ self.assertEqual("2012.10-LOCALBRANCH:LOCALREVISION",
65+ self.version.version_string_with_vcs())