summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@redhat.com>2013-03-19 08:58:33 +0100
committerMatěj Cepl <mcepl@redhat.com>2013-03-19 09:56:02 +0100
commit5e3b3e6bb82a96c7651c54fa498963298356824a (patch)
treed66e22f140226edb13b71725f0eb06aaea58ed6b
parenta132212cf888ee9bcbff11956e4c95fafab92913 (diff)
downloadappdirs-5e3b3e6bb82a96c7651c54fa498963298356824a.tar.gz
Add support for Travis-CI
Trying maximum test coverage and most simple setup. Fixes #21 Signed-off-by: Matěj Cepl <mcepl@redhat.com>
-rw-r--r--.travis.yml9
-rw-r--r--setup.py21
2 files changed, 24 insertions, 6 deletions
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..f6e19fe
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,9 @@
+language: python
+python:
+ - "2.5"
+ - "2.6"
+ - "2.7"
+ - "pypy"
+ - "3.2"
+ - "3.3"
+script: python setup.py test
diff --git a/setup.py b/setup.py
index c12eb62..a787d65 100644
--- a/setup.py
+++ b/setup.py
@@ -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 @@ class RunTests(Command):
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',