]> granicus.if.org Git - python/commitdiff
Brange merge
authorÉric Araujo <merwok@netwok.org>
Fri, 17 Jun 2011 17:38:38 +0000 (19:38 +0200)
committerÉric Araujo <merwok@netwok.org>
Fri, 17 Jun 2011 17:38:38 +0000 (19:38 +0200)
1  2 
Lib/packaging/tests/test_command_build_ext.py

index 13bfeea5d92030317f98c1d0401f3802fb7183ba,930a38f4e82b0171279041ca9c2a7f254932f155..8f61ce42e4d7aea216e006130f3214345cc69884
@@@ -33,6 -37,16 +33,14 @@@ class BuildExtTestCase(support.TempdirM
          site.USER_BASE = self.mkdtemp()
          build_ext.USER_BASE = site.USER_BASE
  
 -        unload('xx')
 -        sys.path.remove(self.tmp_dir)
+     def tearDown(self):
+         # Get everything back to normal
+         if sys.version > "2.6":
+             site.USER_BASE = self.old_user_base
+             build_ext.USER_BASE = self.old_user_base
+         super(BuildExtTestCase, self).tearDown()
      def _fixup_command(self, cmd):
          # When Python was build with --enable-shared, -L. is not good enough
          # to find the libpython<blah>.so.  This is because regrtest runs it
          finally:
              sys.stdout = old_stdout
  
 -        if ALREADY_TESTED:
 -            return
 -        else:
 -            ALREADY_TESTED = True
 +        code = """if 1:
 +            import sys
 +            sys.path.insert(0, %r)
  
 -        import xx
 +            import xx
  
 -        for attr in ('error', 'foo', 'new', 'roj'):
 -            self.assertTrue(hasattr(xx, attr))
 +            for attr in ('error', 'foo', 'new', 'roj'):
 +                assert hasattr(xx, attr)
  
 -        self.assertEqual(xx.foo(2, 5), 7)
 -        self.assertEqual(xx.foo(13, 15), 28)
 -        self.assertEqual(xx.new().demo(), None)
 -        doc = 'This is a template module just for instruction.'
 -        self.assertEqual(xx.__doc__, doc)
 -        self.assertTrue(isinstance(xx.Null(), xx.Null))
 -        self.assertTrue(isinstance(xx.Str(), xx.Str))
 +            assert xx.foo(2, 5) == 7
 +            assert xx.foo(13, 15) == 28
 +            assert xx.new().demo() is None
 +            doc = 'This is a template module just for instruction.'
 +            assert xx.__doc__ == doc
 +            assert isinstance(xx.Null(), xx.Null)
 +            assert isinstance(xx.Str(), xx.Str)"""
 +        code = code % self.tmp_dir
 +        assert_python_ok('-c', code)
  
-     def tearDown(self):
-         # Get everything back to normal
-         if sys.version > "2.6":
-             site.USER_BASE = self.old_user_base
-             build_ext.USER_BASE = self.old_user_base
-         super(BuildExtTestCase, self).tearDown()
      def test_solaris_enable_shared(self):
          dist = Distribution({'name': 'xx'})
          cmd = build_ext(dist)