From 8fe54f1a745d3d2ddb434a8b524c84be47464800 Mon Sep 17 00:00:00 2001 From: Randy Barlow Date: Dec 21 2016 19:13:22 +0000 Subject: Use imp.reload() to get coverage to think we covered __init__.py. fixes #11 Signed-off-by: Randy Barlow --- diff --git a/fegistry/tests/test___init__.py b/fegistry/tests/test___init__.py new file mode 100644 index 0000000..37b61f4 --- /dev/null +++ b/fegistry/tests/test___init__.py @@ -0,0 +1,35 @@ +# Copyright ⓒ 2016 Red Hat, Inc. +# This file is part of fegistry. +# +# fegistry is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# fegistry is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Foobar. If not, see . +"""This test suite contains tests on fegistry.__init__.""" + +import imp + +import unittest + +import fegistry + + +# Since setup.py imports fegistry to get the version before launching nose/coverage, coverage thinks +# we are missing coverage on fegistry's top level __init__.py. We can use imp.reload() to make +# coverage happy. Plus, why not assert that the __version__ is a string while we're at it? +imp.reload(fegistry) + + +class TestVersion(unittest.TestCase): + """This test class contains tests on the __version__ attribute.""" + def test___version__(self): + """Make sure the version is a string.""" + self.assertTrue(isinstance(fegistry.__version__, str))