[Python-checkins] python/dist/src/Lib/distutils/tests support.py, NONE, 1.1 test_install_scripts.py, 1.2, 1.3

fdrake at users.sourceforge.net fdrake at users.sourceforge.net
Thu Jun 17 16:14:52 EDT 2004


Update of /cvsroot/python/python/dist/src/Lib/distutils/tests
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv466/tests
Modified Files:
	test_install_scripts.py 
Added Files:
	support.py 
Log Message:
move support code to a helper module to ease re-use
--- NEW FILE: support.py ---
"""Support code for distutils test cases."""
import shutil
import tempfile
class TempdirManager(object):
 """Mix-in class that handles temporary directories for test cases.
 This is intended to be used with unittest.TestCase.
 """
 def setUp(self):
 super(TempdirManager, self).setUp()
 self.tempdirs = []
 def tearDown(self):
 super(TempdirManager, self).tearDown()
 while self.tempdirs:
 d = self.tempdirs.pop()
 shutil.rmtree(d)
 def mkdtemp(self):
 """Create a temporary directory that will be cleaned up.
 Returns the path of the directory.
 """
 d = tempfile.mkdtemp()
 self.tempdirs.append(d)
 return d
class DummyCommand:
 """Class to store options for retrieval via set_undefined_options()."""
 def __init__(self, **kwargs):
 for kw, val in kwargs.items():
 setattr(self, kw, val)
 def ensure_finalized(self):
 pass
Index: test_install_scripts.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/distutils/tests/test_install_scripts.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** test_install_scripts.py	15 Jun 2004 16:55:46 -0000	1.2
--- test_install_scripts.py	17 Jun 2004 20:14:50 -0000	1.3
***************
*** 2,7 ****
 
 import os
- import shutil
- import tempfile
 import unittest
 
--- 2,5 ----
***************
*** 9,36 ****
 from distutils.core import Distribution
 
 
- class InstallScriptsTestCase(unittest.TestCase):
- 
- def setUp(self):
- self.tempdirs = []
- 
- def tearDown(self):
- while self.tempdirs:
- d = self.tempdirs.pop()
- shutil.rmtree(d)
- 
- def mkdtemp(self):
- """Create a temporary directory that will be cleaned up.
 
! Returns the path of the directory.
! """
! d = tempfile.mkdtemp()
! self.tempdirs.append(d)
! return d
 
 def test_default_settings(self):
 dist = Distribution()
! dist.command_obj["build"] = DummyCommand(build_scripts="/foo/bar")
! dist.command_obj["install"] = DummyCommand(
 install_scripts="/splat/funk",
 force=1,
--- 7,20 ----
 from distutils.core import Distribution
 
+ from distutils.tests import support
 
 
! class InstallScriptsTestCase(support.TempdirManager, unittest.TestCase):
 
 def test_default_settings(self):
 dist = Distribution()
! dist.command_obj["build"] = support.DummyCommand(
! build_scripts="/foo/bar")
! dist.command_obj["install"] = support.DummyCommand(
 install_scripts="/splat/funk",
 force=1,
***************
*** 72,77 ****
 target = self.mkdtemp()
 dist = Distribution()
! dist.command_obj["build"] = DummyCommand(build_scripts=source)
! dist.command_obj["install"] = DummyCommand(
 install_scripts=target,
 force=1,
--- 56,61 ----
 target = self.mkdtemp()
 dist = Distribution()
! dist.command_obj["build"] = support.DummyCommand(build_scripts=source)
! dist.command_obj["install"] = support.DummyCommand(
 install_scripts=target,
 force=1,
***************
*** 87,101 ****
 
 
- class DummyCommand:
- """Class to store options for retrieval via set_undefined_options()."""
- 
- def __init__(self, **kwargs):
- for kw, val in kwargs.items():
- setattr(self, kw, val)
- 
- def ensure_finalized(self):
- pass
- 
- 
 
 def test_suite():
--- 71,74 ----


More information about the Python-checkins mailing list

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