aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--setup.py34
-rw-r--r--tests/run-test-suite.py8
-rwxr-xr-xtests/test-python3.sh2
-rwxr-xr-xtests/test.sh2
4 files changed, 30 insertions, 16 deletions
diff --git a/setup.py b/setup.py
index 228d15a..cfe9aa1 100644
--- a/setup.py
+++ b/setup.py
@@ -4,11 +4,13 @@
package_version = '2.2.0'
#######################################
+from distutils.cmd import Command
from distutils.command.build import build
from distutils.command.install import install
-import fileinput, os, sys
+import fileinput, os, sys, unittest
-class my_build(build):
+
+class jc_build(build):
def run(self):
build.run(self)
@@ -22,7 +24,31 @@ class my_build(build):
sys.stdout.write(line.replace('@GENTOO_PORTAGE_EPREFIX@', eprefix))
-class my_install(install):
+class jc_test(Command):
+
+ user_options = []
+
+ def initialize_options(self):
+ self.build_base = None
+ self.build_lib = None
+
+ def finalize_options(self):
+ self.set_undefined_options('build', ('build_lib', 'build_lib'))
+
+ def run(self):
+ self.run_command('build')
+
+ sys.path.insert(0, 'tests')
+ sys.path.insert(0, self.build_lib)
+
+ import testsuite
+ suite = unittest.defaultTestLoader.loadTestsFromNames(testsuite.__all__, testsuite)
+
+ result = unittest.TextTestRunner().run(suite)
+ sys.exit(not result.wasSuccessful())
+
+
+class jc_install(install):
"""
Generate and install the jdk defaults configuration file.
@@ -70,7 +96,7 @@ class my_install(install):
from distutils.core import setup
setup (
- cmdclass={'build' : my_build, 'install' : my_install},
+ cmdclass={'build' : jc_build, 'test' : jc_test, 'install' : jc_install},
name = 'java-config',
version = package_version,
description = 'java enviroment configuration tool',
diff --git a/tests/run-test-suite.py b/tests/run-test-suite.py
deleted file mode 100644
index 6b123fc..0000000
--- a/tests/run-test-suite.py
+++ /dev/null
@@ -1,8 +0,0 @@
-import unittest as u
-import testsuite
-import sys
-
-suite = u.defaultTestLoader.loadTestsFromNames(testsuite.__all__, testsuite)
-
-result = u.TextTestRunner().run(suite)
-sys.exit(not result.wasSuccessful())
diff --git a/tests/test-python3.sh b/tests/test-python3.sh
deleted file mode 100755
index c90a948..0000000
--- a/tests/test-python3.sh
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/usr/bin/env sh
-PYTHONPATH="../src" python3 run-test-suite.py
diff --git a/tests/test.sh b/tests/test.sh
deleted file mode 100755
index 47fff5d..0000000
--- a/tests/test.sh
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/usr/bin/env sh
-PYTHONPATH="../src" python "`dirname $0`"/run-test-suite.py