[Python-checkins] distutils2: Mock sysconfig.get_paths in the mkcfg tests, in order to have the same output

tarek.ziade python-checkins at python.org
Wed Feb 16 22:23:56 CET 2011


tarek.ziade pushed f20a7df21e50 to distutils2:

http://hg.python.org/distutils2/rev/f20a7df21e50
changeset:   1021:f20a7df21e50
user:        Alexis Metaireau <alexis at notmyidea.org>
date:        Sat Feb 12 00:02:26 2011 +0000
summary:
  Mock sysconfig.get_paths in the mkcfg tests, in order to have the same output in everywhere.

files:
  distutils2/tests/test_mkcfg.py

diff --git a/distutils2/tests/test_mkcfg.py b/distutils2/tests/test_mkcfg.py
--- a/distutils2/tests/test_mkcfg.py
+++ b/distutils2/tests/test_mkcfg.py
@@ -8,6 +8,7 @@
 from distutils2.tests import run_unittest, support, unittest
 from distutils2.mkcfg import MainProgram
 from distutils2.mkcfg import ask_yn, ask, main
+from distutils2._backport import sysconfig
 
 
 class MkcfgTestCase(support.TempdirManager,
@@ -22,12 +23,18 @@
         self._cwd = os.getcwd()
         self.wdir = self.mkdtemp()
         os.chdir(self.wdir)
+        # patch sysconfig
+        self._old_get_paths = sysconfig.get_paths
+        sysconfig.get_paths = lambda *args, **kwargs: {
+                'man': sys.prefix + '/share/man', 
+                'doc': sys.prefix + '/share/doc/pyxfoil',}
 
     def tearDown(self):
         super(MkcfgTestCase, self).tearDown()
         sys.stdin = self._stdin
         sys.stdout = self._stdout
         os.chdir(self._cwd)
+        sysconfig.get_paths = self._old_get_paths
 
     def test_ask_yn(self):
         sys.stdin.write('y\n')

--
Repository URL: http://hg.python.org/distutils2


More information about the Python-checkins mailing list