[Python-checkins] cpython: Issue 24208: Fix tests -- don't create a tempdir in __init__.

yury.selivanov python-checkins at python.org
Sat May 16 16:10:28 CEST 2015


https://hg.python.org/cpython/rev/08829230079b
changeset:   96087:08829230079b
user:        Yury Selivanov <yselivanov at sprymix.com>
date:        Sat May 16 10:10:21 2015 -0400
summary:
  Issue 24208: Fix tests -- don't create a tempdir in __init__.

files:
  Lib/test/test_inspect.py |  8 +++-----
  1 files changed, 3 insertions(+), 5 deletions(-)


diff --git a/Lib/test/test_inspect.py b/Lib/test/test_inspect.py
--- a/Lib/test/test_inspect.py
+++ b/Lib/test/test_inspect.py
@@ -288,9 +288,7 @@
     # Subclasses must override.
     fodderModule = None
 
-    def __init__(self, *args, **kwargs):
-        unittest.TestCase.__init__(self, *args, **kwargs)
-
+    def setUp(self):
         with open(inspect.getsourcefile(self.fodderModule)) as fp:
             self.source = fp.read()
 
@@ -571,7 +569,7 @@
         self.assertSourceEqual(mod2.ClassWithMethod.method, 118, 119)
 
 class TestNoEOL(GetSourceBase):
-    def __init__(self, *args, **kwargs):
+    def setUp(self):
         self.tempdir = TESTFN + '_dir'
         os.mkdir(self.tempdir)
         with open(os.path.join(self.tempdir,
@@ -580,7 +578,7 @@
         with DirsOnSysPath(self.tempdir):
             import inspect_fodder3 as mod3
         self.fodderModule = mod3
-        GetSourceBase.__init__(self, *args, **kwargs)
+        super().setUp()
 
     def tearDown(self):
         shutil.rmtree(self.tempdir)

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list