aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/command/test.py
diff options
context:
space:
mode:
authorPJ Eby <distutils-sig@python.org>2005-07-21 00:51:07 +0000
committerPJ Eby <distutils-sig@python.org>2005-07-21 00:51:07 +0000
commita462bb3f8cfdf798b62e7e4b5f06cbe56b2cedfd (patch)
tree97ec94e7b548b03766ac75a80dc2b781ae128e76 /setuptools/command/test.py
parent2a8ed3cc6b73dfe63fe6d8c2f72229290549887b (diff)
downloadexternal_python_setuptools-a462bb3f8cfdf798b62e7e4b5f06cbe56b2cedfd.tar.gz
external_python_setuptools-a462bb3f8cfdf798b62e7e4b5f06cbe56b2cedfd.tar.bz2
external_python_setuptools-a462bb3f8cfdf798b62e7e4b5f06cbe56b2cedfd.zip
Make 'test' command work correctly with the 0.6 WorkingSet class.
--HG-- branch : setuptools extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/trunk/setuptools%4041140
Diffstat (limited to 'setuptools/command/test.py')
-rw-r--r--setuptools/command/test.py24
1 files changed, 12 insertions, 12 deletions
diff --git a/setuptools/command/test.py b/setuptools/command/test.py
index 2b0d9484..200d255d 100644
--- a/setuptools/command/test.py
+++ b/setuptools/command/test.py
@@ -1,6 +1,7 @@
from setuptools import Command
from distutils.errors import DistutilsOptionError
import sys
+from pkg_resources import *
class test(Command):
@@ -38,7 +39,6 @@ class test(Command):
if self.verbose:
self.test_args.insert(0,'--verbose')
-
def run(self):
# Ensure metadata is up-to-date
self.run_command('egg_info')
@@ -56,19 +56,19 @@ class test(Command):
self.run_tests()
def run_tests(self):
- import unittest, pkg_resources
+ import unittest
old_path = sys.path[:]
ei_cmd = self.get_finalized_command("egg_info")
- try:
- # put the egg on sys.path, and require() it
- sys.path.insert(0, ei_cmd.egg_base)
- pkg_resources.require(
- "%s==%s" % (ei_cmd.egg_name, ei_cmd.egg_version)
- )
- unittest.main(None, None, [unittest.__file__]+self.test_args)
- finally:
- sys.path[:] = old_path
- # XXX later this might need to save/restore the WorkingSet
+ path_item = normalize_path(ei_cmd.egg_base)
+ metadata = PathMetadata(
+ path_item, normalize_path(ei_cmd.egg_info)
+ )
+ dist = Distribution(path_item, metadata, project_name=ei_cmd.egg_name)
+ working_set.add(dist)
+ require(str(dist.as_requirement()))
+ unittest.main(None, None, [unittest.__file__]+self.test_args)
+
+