#12 Use imp.reload() to get coverage to think we covered __init__.py.
Merged 3 years ago by bowlofeggs. Opened 3 years ago by bowlofeggs.
bowlofeggs/fegistry coverage_problem  into  master

@@ -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 <http://www.gnu.org/licenses/>.

s/Foobar/fegistry

Oh I didn't notice this comment when I looked at the PR. I'm used to GitHub where comments are shown with some context in the Comments tab and I just plain didn't see this!

I'll make another PR that fixes this, because I copied this from other files and they probably all do it (I got this from gnu.org ☺).

I filed https://pagure.io/fegistry/pull-request/13 to fix the Foobars across the project, and I filed https://pagure.io/pagure/issue/1685 to request that comments not be hidden by default (since I missed yours!).

+ """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))

Pull-Request has been merged by bowlofeggs

3 years ago

Oh I didn't notice this comment when I looked at the PR. I'm used to GitHub where comments are shown with some context in the Comments tab and I just plain didn't see this!

I'll make another PR that fixes this, because I copied this from other files and they probably all do it (I got this from gnu.org ☺).

I filed https://pagure.io/fegistry/pull-request/13 to fix the Foobars across the project, and I filed https://pagure.io/pagure/issue/1685 to request that comments not be hidden by default (since I missed yours!).

Metadata