~ubuntu-branches/ubuntu/natty/python-distutils-extra/natty-updates

« back to all changes in this revision

Viewing changes to test/auto.py

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2010-11-18 11:39:08 UTC
  • mto: This revision was merged to the branch mainline in revision 22.
  • Revision ID: james.westby@ubuntu.com-20101118113908-c10v3lni0h7oe9jb
Tags: upstream-2.23
ImportĀ upstreamĀ versionĀ 2.23

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 
3
3
# test DistUtilsExtra.auto
4
4
 
5
 
import sys, unittest, shutil, tempfile, os, os.path, subprocess, re
 
5
import unittest, shutil, tempfile, os, os.path, subprocess, re
6
6
 
7
7
class T(unittest.TestCase):
8
8
    def setUp(self):
9
9
        self.src = tempfile.mkdtemp()
10
10
 
11
11
        self._mksrc('setup.py', '''
 
12
# ignore warning about import from local path
 
13
import warnings
 
14
warnings.filterwarnings('ignore', 'Module DistUtilsExtra was already imported from.*')
 
15
 
12
16
from DistUtilsExtra.auto import setup
13
17
 
14
18
setup(
28
32
        try:
29
33
            # check that setup.py clean removes everything
30
34
            (o, e, s) = self.setup_py(['clean', '-a'])
31
 
            self.assertEqual(s, 0)
 
35
            self.assertEqual(s, 0, o+e)
32
36
            cruft = self.diff_snapshot()
33
37
            self.assertEqual(cruft, '', 'no cruft after cleaning:\n' + cruft)
34
38
        finally:
707
711
 
708
712
        # check requires
709
713
        req = [prop.split(' ', 1)[1] for prop in egg if prop.startswith('Requires: ')]
710
 
        self.assertEqual(set(req), set(['DistUtilsExtra.auto', 'httplib2', 'pkg_resources']))
 
714
        self.assertEqual(set(req), set(['httplib2', 'pkg_resources']))
711
715
 
712
716
    def test_help(self):
713
717
        '''Docbook XML help'''
755
759
        if not self.snapshot:
756
760
            self.do_snapshot()
757
761
 
758
 
        env = os.environ
 
762
        env = os.environ.copy()
759
763
        oldcwd = os.getcwd()
760
 
        if 'PYTHONPATH' not in env:
 
764
        if 'PYTHONPATH' in env:
 
765
            env['PYTHONPATH'] = oldcwd + os.pathsep + env['PYTHONPATH']
 
766
        else:
761
767
            env['PYTHONPATH'] = oldcwd
762
768
        os.chdir(self.src)
763
769
        s = subprocess.Popen(['/proc/self/exe', 'setup.py'] + args, env=env,