~ubuntu-branches/ubuntu/lucid/python2.6/lucid

« back to all changes in this revision

Viewing changes to Lib/test/test_macostools.py

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2010-03-11 13:30:19 UTC
  • mto: (10.1.13 sid)
  • mto: This revision was merged to the branch mainline in revision 44.
  • Revision ID: james.westby@ubuntu.com-20100311133019-sblbooa3uqrkoe70
Tags: upstream-2.6.5~rc2
ImportĀ upstreamĀ versionĀ 2.6.5~rc2

Show diffs side-by-side

added added

removed removed

Lines of Context:
57
57
                                    DeprecationWarning)
58
58
            macostools.touched(test_support.TESTFN)
59
59
 
60
 
    def test_copy(self):
61
 
        try:
62
 
            os.unlink(TESTFN2)
63
 
        except:
64
 
            pass
65
 
        macostools.copy(test_support.TESTFN, TESTFN2)
66
 
        self.assertEqual(self.compareData(), '')
67
 
 
68
 
    def test_mkalias(self):
69
 
        try:
70
 
            os.unlink(TESTFN2)
71
 
        except:
72
 
            pass
73
 
        macostools.mkalias(test_support.TESTFN, TESTFN2)
74
 
        fss, _, _ = Carbon.File.ResolveAliasFile(TESTFN2, 0)
75
 
        self.assertEqual(fss.as_pathname(), os.path.realpath(test_support.TESTFN))
76
 
 
77
 
    def test_mkalias_relative(self):
78
 
        try:
79
 
            os.unlink(TESTFN2)
80
 
        except:
81
 
            pass
82
 
        # If the directory doesn't exist, then chances are this is a new
83
 
        # install of Python so don't create it since the user might end up
84
 
        # running ``sudo make install`` and creating the directory here won't
85
 
        # leave it with the proper permissions.
86
 
        if not os.path.exists(sys.prefix):
87
 
            return
88
 
        macostools.mkalias(test_support.TESTFN, TESTFN2, sys.prefix)
89
 
        fss, _, _ = Carbon.File.ResolveAliasFile(TESTFN2, 0)
90
 
        self.assertEqual(fss.as_pathname(), os.path.realpath(test_support.TESTFN))
 
60
    if sys.maxint < 2**32:
 
61
        def test_copy(self):
 
62
            try:
 
63
                os.unlink(TESTFN2)
 
64
            except:
 
65
                pass
 
66
            macostools.copy(test_support.TESTFN, TESTFN2)
 
67
            self.assertEqual(self.compareData(), '')
 
68
 
 
69
    if sys.maxint < 2**32:
 
70
        def test_mkalias(self):
 
71
            try:
 
72
                os.unlink(TESTFN2)
 
73
            except:
 
74
                pass
 
75
            macostools.mkalias(test_support.TESTFN, TESTFN2)
 
76
            fss, _, _ = Carbon.File.ResolveAliasFile(TESTFN2, 0)
 
77
            self.assertEqual(fss.as_pathname(), os.path.realpath(test_support.TESTFN))
 
78
 
 
79
        def test_mkalias_relative(self):
 
80
            try:
 
81
                os.unlink(TESTFN2)
 
82
            except:
 
83
                pass
 
84
            # If the directory doesn't exist, then chances are this is a new
 
85
            # install of Python so don't create it since the user might end up
 
86
            # running ``sudo make install`` and creating the directory here won't
 
87
            # leave it with the proper permissions.
 
88
            if not os.path.exists(sys.prefix):
 
89
                return
 
90
            macostools.mkalias(test_support.TESTFN, TESTFN2, sys.prefix)
 
91
            fss, _, _ = Carbon.File.ResolveAliasFile(TESTFN2, 0)
 
92
            self.assertEqual(fss.as_pathname(), os.path.realpath(test_support.TESTFN))
91
93
 
92
94
 
93
95
def test_main():