summaryrefslogtreecommitdiff
path: root/src/distutils2/command
diff options
context:
space:
mode:
authorKonrad Delong <konryd@gmail.com>2010-07-27 14:31:15 +0200
committerKonrad Delong <konryd@gmail.com>2010-07-27 14:31:15 +0200
commitc2fc68544d285850b54d4dc5b0dd04307a628833 (patch)
tree83b0c9f66393de5d2d7929a67df17bb594221265 /src/distutils2/command
parent24bae4d05ba07b0054e631b731bdda8525530ce0 (diff)
downloaddisutils2-c2fc68544d285850b54d4dc5b0dd04307a628833.tar.gz
basic functional test for the test command
Diffstat (limited to 'src/distutils2/command')
-rw-r--r--src/distutils2/command/test.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/distutils2/command/test.py b/src/distutils2/command/test.py
new file mode 100644
index 0000000..31597bd
--- /dev/null
+++ b/src/distutils2/command/test.py
@@ -0,0 +1,30 @@
+import os, sys
+from distutils2.core import Command
+import unittest
+
+class test(Command):
+
+ description = "" # TODO
+ user_options = [
+ ('test-suite=','s',
+ "Test suite to run (e.g. 'some_module.test_suite')"),
+ ]
+
+ def initialize_options(self):
+ self.test_suite = None
+
+ def finalize_options(self):
+ pass
+
+ def distpath(self):
+ self.run_command('build')
+ build_cmd = self.get_finalized_command("build")
+ return os.path.join(build_cmd.build_base, "lib")
+
+ def run(self):
+ orig_path = sys.path[:]
+ try:
+ sys.path.insert(0, self.distpath())
+ unittest.main(module=self.test_suite, argv=sys.argv[:1])
+ finally:
+ sys.path[:] = orig_path