summaryrefslogtreecommitdiffstats
path: root/setup.py
diff options
context:
space:
mode:
authorBenjamin Dauvergne <bdauvergne@entrouvert.com>2012-01-31 09:59:26 (GMT)
committerBenjamin Dauvergne <bdauvergne@entrouvert.com>2012-01-31 09:59:26 (GMT)
commit4f0def0fd37bff3321895ef00271501d1172468e (patch)
treec2f3b45f338bbc90e64ffcd0337d5ee7db552772 /setup.py
parent40a4e5ffa1b18d128cd3f0a244eabfbfb552870a (diff)
downloadeopayment-4f0def0fd37bff3321895ef00271501d1172468e.zip
eopayment-4f0def0fd37bff3321895ef00271501d1172468e.tar.gz
eopayment-4f0def0fd37bff3321895ef00271501d1172468e.tar.bz2
add unit tests for spplus module
Diffstat (limited to 'setup.py')
-rw-r--r--setup.py31
1 files changed, 30 insertions, 1 deletions
diff --git a/setup.py b/setup.py
index 4ff3468..d4c21aa 100644
--- a/setup.py
+++ b/setup.py
@@ -6,7 +6,35 @@ Setup script for eopayment
import distutils
import distutils.core
+from glob import glob
+from os.path import splitext, basename, join as pjoin
+import os
import re
+from unittest import TextTestRunner, TestLoader
+
+class TestCommand(distutils.core.Command):
+ user_options = [ ]
+
+ def initialize_options(self):
+ self._dir = os.getcwd()
+
+ def finalize_options(self):
+ pass
+
+ def run(self):
+ '''
+ Finds all the tests modules in tests/, and runs them.
+ '''
+ testfiles = [ ]
+ for t in glob(pjoin(self._dir, 'tests', '*.py')):
+ if not t.endswith('__init__.py'):
+ testfiles.append('.'.join(
+ ['tests', splitext(basename(t))[0]])
+ )
+
+ tests = TestLoader().loadTestsFromNames(testfiles)
+ t = TextTestRunner(verbosity = 4)
+ t.run(tests)
def get_version():
text = file('eopayment/__init__.py').read()
@@ -29,4 +57,5 @@ distutils.core.setup(name='eopayment',
packages=['eopayment'],
requires=[
'pycrypto (>= 2.5)'
- ])
+ ],
+ cmdclass={'test': TestCommand})