[Python-checkins] distutils2: test command uses resolve_dotted_name, desctiption added, _backport.any fix,

tarek.ziade python-checkins at python.org
Sun Sep 19 10:20:22 CEST 2010


tarek.ziade pushed 8e9ad8266328 to distutils2:
http://hg.python.org/distutils2/rev/8e9ad8266328
changeset: 611:8e9ad8266328
user: Konrad Delong <konryd at gmail.com>
date: Thu Aug 12 19:59:22 2010 +0200
summary: test command uses resolve_dotted_name, desctiption added, _backport.any fix, added test to commands.__all__
files: src/distutils2/_backport/__init__.py, src/distutils2/command/__init__.py, src/distutils2/command/test.py
diff --git a/src/distutils2/_backport/__init__.py b/src/distutils2/_backport/__init__.py
--- a/src/distutils2/_backport/__init__.py
+++ b/src/distutils2/_backport/__init__.py
@@ -4,5 +4,5 @@
 def any(seq):
 for elem in seq:
 if elem:
- return elem
+ return True
 return False
diff --git a/src/distutils2/command/__init__.py b/src/distutils2/command/__init__.py
--- a/src/distutils2/command/__init__.py
+++ b/src/distutils2/command/__init__.py
@@ -23,5 +23,6 @@
 'bdist_dumb',
 'bdist_wininst',
 'register',
+ 'test',
 'upload',
 ]
diff --git a/src/distutils2/command/test.py b/src/distutils2/command/test.py
--- a/src/distutils2/command/test.py
+++ b/src/distutils2/command/test.py
@@ -1,32 +1,13 @@
 import os, sys
 from distutils2.core import Command 
 from distutils2._backport.pkgutil import get_distribution
+from distutils2.util import resolve_dotted_name
 import unittest
 import warnings
 
-def get_loader_instance(dotted_path):
- if dotted_path is None:
- return None
- module_name, rest = dotted_path.split('.')[0], dotted_path.split('.')[1:]
- while True:
- try:
- ret = __import__(module_name)
- break
- except ImportError:
- if rest == []:
- return None
- module_name += ('.' + rest[0])
- rest = rest[1:]
- while rest:
- try:
- ret = getattr(ret, rest.pop(0))
- except AttributeError:
- return None
- return ret()
-
 class test(Command):
 
- description = "" # TODO
+ description = "run the distribution's test suite"
 user_options = [
 ('test-suite=', 's',
 "Test suite to run (e.g. 'some_module.test_suite')"),
@@ -56,7 +37,7 @@
 os.chdir(self.build_lib)
 args = {"module": self.test_suite,
 "argv": sys.argv[:1],
- "testLoader": get_loader_instance(self.test_loader)
+ "testLoader": resolve_dotted_name(self.test_loader)
 }
 if args['testLoader'] is None:
 del args['testLoader']
--
Repository URL: http://hg.python.org/distutils2


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /