Permalink
Browse files

Add support for Travis-CI

Trying maximum test coverage and most simple setup.

Fixes #21

Signed-off-by: Matěj Cepl <mcepl@redhat.com>
  • Loading branch information...
1 parent a132212 commit 5e3b3e6bb82a96c7651c54fa498963298356824a @mcepl mcepl committed Mar 19, 2013
Showing with 24 additions and 6 deletions.
  1. +9 −0 .travis.yml
  2. +15 −6 setup.py
View
@@ -0,0 +1,9 @@
+language: python
+python:
+ - "2.5"
+ - "2.6"
+ - "2.7"
+ - "pypy"
+ - "3.2"
+ - "3.3"
+script: python setup.py test
View
@@ -1,7 +1,7 @@
#!/usr/bin/env python
-
import sys
import os
+import os.path
from distutils.core import setup, Command
import appdirs
@@ -29,14 +29,23 @@ def finalize_options(self):
pass
def run(self):
- tests = unittest.TestLoader().discover('.')
- runner = unittest.TextTestRunner(verbosity=2)
- runner.run(tests)
+ test_modules = ["test.%s" % filename.replace('.py', '')
+ for filename in os.listdir('test')
+ if filename.endswith('.py') and filename.startswith('test_')]
+ for mod in test_modules:
+ __import__(mod)
+
+ suite = unittest.TestSuite()
+ for mod in [sys.modules[modname] for modname in test_modules]:
+ suite.addTest(unittest.TestLoader().loadTestsFromModule(mod))
+ unittest.TextTestRunner(verbosity=2).run(suite)
def read(fname):
- with open(os.path.join(os.path.dirname(__file__), fname)) as inf:
- return "\n" + inf.read().replace("\r\n", "\n")
+ inf = open(os.path.join(os.path.dirname(__file__), fname))
+ out = "\n" + inf.read().replace("\r\n", "\n")
+ inf.close()
+ return out
setup(name='appdirs',

0 comments on commit 5e3b3e6

Please sign in to comment.