Skip to content

Commit

Permalink
Modify unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
thp committed Feb 21, 2015
1 parent 270647c commit 022beff
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 16 deletions.
15 changes: 2 additions & 13 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -57,22 +57,11 @@
- doctests http://docs.python.org/3/library/doctest
- unittests http://docs.python.org/3/library/unittest

If you want to add doctests, simply write the doctest and make sure that
the module appears in "doctest_modules" in src/gpodder/test/__init__.py.
For example, the doctests in src/gpodder/util.py are added as 'util' (the
"gpodder" prefix must not be specified there).

If you want to add unit tests for a specific module (ex: gpodder.model),
you should add the tests as test_gpodder.model, or in other words:
you should add the tests as test_gpodder.test_model, or in other words:

The file src/gpodder/model.py
is tested by tests/test_gpodder/model.py

After you've added the test, make sure that the module appears in
"test_modules" in tests/test_gpodder/__init__.py - for the example above,
the unittests in tests/test_gpodder/model.py are added as 'model'. For unit
tests, coverage reporting happens for the tested module (that's why the
test module name should mirror the module to be tested).
is tested by tests/test_gpodder/test_model.py


[ RUNNING AND INSTALLATION ]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ def setUp(self):
self.video_episode.mime_type = 'video/mp4'

def test_audio(self):
self.podcast.children = [self.audio_episode]
self.podcast._children = [self.audio_episode]
self.assertEqual(self.podcast._get_content_type(), 'audio')

def test_video(self):
self.podcast.children = [self.video_episode]
self.podcast._children = [self.video_episode]
self.assertEqual(self.podcast._get_content_type(), 'video')

def test_more_video_than_audio(self):
self.podcast.children = [self.audio_episode, self.video_episode, self.video_episode]
self.podcast._children = [self.audio_episode, self.video_episode, self.video_episode]
self.assertEqual(self.podcast._get_content_type(), 'video')

0 comments on commit 022beff

Please sign in to comment.