Permalink
Browse files

Add support to run tests (unittests & doctests)

It currently uses the setuptools/distribute machinery to run the tests,
but if we stick to running the 'run-tests' script to actually run the
test, we can easily change the runner without too much interferences...
  • Loading branch information...
1 parent 550aa73 commit 315a16bb3cba4fb540b4a181f6ea10e3226a9d84 @multani committed Jun 26, 2011
Showing with 37 additions and 0 deletions.
  1. +3 −0 run-tests
  2. +11 −0 setup.py
  3. +23 −0 sonata/tests/__init__.py
View
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+python setup.py test
View
@@ -53,6 +53,12 @@ def rmgeneric(path, __func__):
""" % version)
versionfile.close()
+
+tests_require = [
+ 'unittest2',
+]
+
+
setup(name='Sonata',
version=version,
description='GTK+ client for the Music Player Daemon (MPD).',
@@ -108,6 +114,11 @@ def rmgeneric(path, __func__):
'sonata=sonata.launcher:run',
]
},
+ test_suite='sonata.tests',
+ tests_require=tests_require,
+ extras_require={
+ 'test': tests_require,
+ },
)
# Cleanup (remove /build, /mo, and *.pyc files:
View
@@ -0,0 +1,23 @@
+import doctest
+import unittest2
+
+
+DOCTEST_FLAGS = (
+ doctest.ELLIPSIS |
+ doctest.NORMALIZE_WHITESPACE |
+ doctest.REPORT_NDIFF
+)
+
+
+class TestSonata(unittest2.TestCase):
+ def test_dummy(self):
+ # TODO: replace with a test which does something once we start to have
+ # tests!
+ pass
+
+
+def additional_tests():
+ return unittest2.TestSuite(
+ # TODO: add files which use doctests here
+ #doctest.DocFileSuite('../audioscrobbler.py', optionflags=DOCTEST_FLAGS),
+ )

0 comments on commit 315a16b

Please sign in to comment.