Skip to content

Commit

Permalink
Added version info (#18)
Browse files Browse the repository at this point in the history
* Added version information to the module via pbr.

* Added tests for module version availability.
  • Loading branch information
NOhs authored Mar 30, 2019
1 parent 098cecb commit 5305e00
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
14 changes: 14 additions & 0 deletions dkey/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,20 @@
====
Function to generate deprecated keys.
__version__
===========
A string indicating which version of dkey is currently used.
version_info
============
A tuple containing the currently used version.
"""
from ._dkey import deprecate_keys as deprecate_keys
from ._dkey import dkey as dkey

from pbr.version import VersionInfo

_v = VersionInfo('mgen').semantic_version()
__version__ = _v.release_string()
version_info = _v.version_tuple()
6 changes: 6 additions & 0 deletions tests/test_dkey.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@

from dkey import deprecate_keys, dkey

class version_test_case(unittest.TestCase):
def test_version_string_available(self):
import dkey as dk
self.assertTrue(hasattr(dk, '__version__'))
self.assertTrue(hasattr(dk, 'version_info'))

class dkey_test_case(unittest.TestCase):
def test_number_of_keys_incorrect(self):
with self.assertRaises(ValueError):
Expand Down

0 comments on commit 5305e00

Please sign in to comment.