[Python-checkins] distutils2: Branch merge
tarek.ziade
python-checkins at python.org
Sat Oct 2 00:52:20 CEST 2010
tarek.ziade pushed b917c7e35bb5 to distutils2:
http://hg.python.org/distutils2/rev/b917c7e35bb5
changeset: 723:b917c7e35bb5
parent: 722:7af455919bec
parent: 717:cb1b9898d0b8
user: ?ric Araujo <merwok at netwok.org>
date: Fri Oct 01 21:03:50 2010 +0200
summary: Branch merge
files: distutils2/tests/test_config.py, distutils2/tests/test_register.py, distutils2/tests/test_test.py, docs/source/distutils/setupscript.rst
diff --git a/distutils2/tests/test_config.py b/distutils2/tests/test_config.py
--- a/distutils2/tests/test_config.py
+++ b/distutils2/tests/test_config.py
@@ -1,8 +1,9 @@
"""Tests for distutils.config."""
+import os
import sys
-import os
-import copy
+from StringIO import StringIO
+from distutils2.core import setup
from distutils2.tests import unittest, support, run_unittest
@@ -16,26 +17,23 @@
class ConfigTestCase(support.TempdirManager,
unittest.TestCase):
+ def setUp(self):
+ super(ConfigTestCase, self).setUp()
+ self.addCleanup(setattr, sys, 'argv', sys.argv[:])
+ self.addCleanup(setattr, sys, 'stdout', sys.stdout)
+ self.addCleanup(os.chdir, os.getcwd())
+
def test_config(self):
tempdir = self.mkdtemp()
- setup_cfg = os.path.join(tempdir, 'setup.cfg')
- f = open(setup_cfg, 'w')
- try:
- f.write(SETUP_CFG)
- finally:
- f.close()
+ os.chdir(tempdir)
+ self.write_file('setup.cfg', SETUP_CFG)
- # trying to load the metadata now
- old_args = copy.copy(sys.argv)
+ # try to load the metadata now
+ sys.stdout = StringIO()
sys.argv[:] = ['setup.py', '--version']
- old_wd = os.getcwd()
- os.chdir(tempdir)
- try:
- from distutils2.core import setup
- dist = setup()
- finally:
- os.chdir(old_wd)
- sys.argv[:] = old_args
+ dist = setup()
+ # sanity check
+ self.assertEqual(sys.stdout.getvalue(), '1.0' + os.linesep)
# check what was done
self.assertEqual(dist.metadata['Author'], 'tarek')
diff --git a/distutils2/tests/test_register.py b/distutils2/tests/test_register.py
--- a/distutils2/tests/test_register.py
+++ b/distutils2/tests/test_register.py
@@ -65,7 +65,9 @@
def read(self):
return 'xxx'
-class RegisterTestCase(support.TempdirManager, support.EnvironGuard,
+class RegisterTestCase(support.TempdirManager,
+ support.EnvironGuard,
+ support.LoggingCatcher,
unittest.TestCase):
def setUp(self):
diff --git a/distutils2/tests/test_test.py b/distutils2/tests/test_test.py
--- a/distutils2/tests/test_test.py
+++ b/distutils2/tests/test_test.py
@@ -10,7 +10,7 @@
from StringIO import StringIO
from distutils2.core import Command
from distutils2.tests import unittest
-from distutils2.tests.support import TempdirManager
+from distutils2.tests.support import TempdirManager, LoggingCatcher
from distutils2.command.test import test
from distutils2.dist import Distribution
from distutils2._backport import pkgutil
@@ -31,6 +31,7 @@
here = os.path.dirname(os.path.abspath(__file__))
class TestTest(TempdirManager,
+ LoggingCatcher,
unittest.TestCase):
def setUp(self):
@@ -76,7 +77,7 @@
orig_has_attr = _hasattr(obj, attr)
if orig_has_attr:
- orig_val = _getattr(obj, attr)
+ orig_val = _getattr(obj, attr)
if delete is False:
_setattr(obj, attr, new_val)
diff --git a/docs/source/conf.py b/docs/source/conf.py
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -12,7 +12,9 @@
# All configuration values have a default; values that are commented out
# serve to show the default.
-import sys, os
+import os
+import sys
+import sphinx
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
@@ -98,7 +100,8 @@
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
-html_theme_options = {'collapsiblesidebar': True}
+if sphinx.__version__[:3] >= '1.0':
+ html_theme_options = {'collapsiblesidebar': True}
# Add any paths that contain custom themes here, relative to this directory.
#html_theme_path = []
diff --git a/docs/source/devresources.rst b/docs/source/devresources.rst
--- a/docs/source/devresources.rst
+++ b/docs/source/devresources.rst
@@ -13,6 +13,9 @@
~~~~~~~~~~~~
* unittest2
+* If your operating system splits core python and a python-dev (or -devel)
+ packages, install the dev package too: It contains header files needed by
+ tests.
Issue Tracker
~~~~~~~~~~~~~
diff --git a/docs/source/distutils/setupscript.rst b/docs/source/distutils/setupscript.rst
--- a/docs/source/distutils/setupscript.rst
+++ b/docs/source/distutils/setupscript.rst
@@ -501,7 +501,7 @@
file if no template is provided. See :ref:`manifest`.
-.. _distutils2-additional-files:
+.. _distutils-additional-files:
Installing Additional Files
===========================
diff --git a/docs/source/distutils/sourcedist.rst b/docs/source/distutils/sourcedist.rst
--- a/docs/source/distutils/sourcedist.rst
+++ b/docs/source/distutils/sourcedist.rst
@@ -142,7 +142,7 @@
python setup.py sdist --manifest-only
-:option:`-o` is a sortcut for :option:`--manifest-only`.
+:option:`-o` is a shortcut for :option:`--manifest-only`.
.. _manifest_template:
--
Repository URL: http://hg.python.org/distutils2
More information about the Python-checkins
mailing list