diff options
author | Anders Sundman <anders@4zm.org> | 2011-05-19 19:55:12 +0200 |
---|---|---|
committer | Anders Sundman <anders@4zm.org> | 2011-05-19 19:55:12 +0200 |
commit | e226cd7f963d2c21c839071d10ed3102b758fdf6 (patch) | |
tree | e3b0c6ade1c88dacb0406dfc23870667868a3c28 /setup.py | |
parent | 606b17789c1869597466c714134f138c51b938f5 (diff) | |
parent | 4669b04c6f9e4cb895abd227dffc7f6718425a70 (diff) | |
download | pycrypto-e226cd7f963d2c21c839071d10ed3102b758fdf6.tar.gz |
Merge from dlitz/master
Diffstat (limited to 'setup.py')
-rw-r--r-- | setup.py | 22 |
1 files changed, 19 insertions, 3 deletions
@@ -267,14 +267,17 @@ class TestCommand(Command): description = "Run self-test" + # Long option name, short option name, description user_options = [ ('skip-slow-tests', None, - 'Skip slow tests') + 'Skip slow tests'), + ('module=', 'm', 'Test a single module (e.g. Cipher, PublicKey)') ] def initialize_options(self): self.build_dir = None self.skip_slow_tests = None + self.module = None def finalize_options(self): self.set_undefined_options('install', ('build_lib', 'build_dir')) @@ -287,8 +290,21 @@ class TestCommand(Command): try: sys.path.insert(0, self.build_dir) from Crypto import SelfTest - SelfTest.run(verbosity=self.verbose, stream=sys.stdout, - config=self.config) + moduleObj = None + if self.module: + if self.module.count('.')==0: + # Test a whole a sub-package + full_module = "Crypto.SelfTest." + self.module + module_name = self.module + else: + # Test only a module + # Assume only one dot is present + comps = self.module.split('.') + module_name = "test_" + comps[1] + full_module = "Crypto.SelfTest." + comps[0] + "." + module_name + # Import sub-package or module + moduleObj = __import__( full_module, globals(), locals(), module_name ) + SelfTest.run(module=moduleObj, verbosity=self.verbose, stream=sys.stdout, config=self.config) finally: # Restore sys.path sys.path[:] = old_path |