Ignore:
Timestamp:
Mar 19, 2014, 11:31:01 PM (11 years ago)
Author:
dmik
Message:

python: Merge vendor 2.7.6 to trunk.

Location:
python/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • python/trunk

  • python/trunk/Lib/test/test_macostools.py

    r2 r391  
    22
    33import unittest
    4 import macostools
    5 import Carbon.File
    6 import MacOS
    74import os
    85import sys
    96from test import test_support
     7
     8MacOS = test_support.import_module('MacOS')
     9#The following modules should exist if MacOS exists.
     10import Carbon.File
     11import macostools
    1012
    1113TESTFN2 = test_support.TESTFN + '2'
     
    2224
    2325    def tearDown(self):
    24         try:
    25             os.unlink(test_support.TESTFN)
    26         except:
    27             pass
    28         try:
    29             os.unlink(TESTFN2)
    30         except:
    31             pass
     26        test_support.unlink(test_support.TESTFN)
     27        test_support.unlink(TESTFN2)
    3228
    3329    def compareData(self):
     
    5248    def test_touched(self):
    5349        # This really only tests that nothing unforeseen happens.
    54         import warnings
    55         with warnings.catch_warnings():
    56             warnings.filterwarnings('ignore', 'macostools.touched*',
    57                                     DeprecationWarning)
     50        with test_support.check_warnings(('macostools.touched*',
     51                                          DeprecationWarning), quiet=True):
    5852            macostools.touched(test_support.TESTFN)
    5953
    6054    if sys.maxint < 2**32:
    6155        def test_copy(self):
    62             try:
    63                 os.unlink(TESTFN2)
    64             except:
    65                 pass
     56            test_support.unlink(TESTFN2)
    6657            macostools.copy(test_support.TESTFN, TESTFN2)
    6758            self.assertEqual(self.compareData(), '')
     
    6960    if sys.maxint < 2**32:
    7061        def test_mkalias(self):
    71             try:
    72                 os.unlink(TESTFN2)
    73             except:
    74                 pass
     62            test_support.unlink(TESTFN2)
    7563            macostools.mkalias(test_support.TESTFN, TESTFN2)
    7664            fss, _, _ = Carbon.File.ResolveAliasFile(TESTFN2, 0)
     
    7866
    7967        def test_mkalias_relative(self):
    80             try:
    81                 os.unlink(TESTFN2)
    82             except:
    83                 pass
     68            test_support.unlink(TESTFN2)
    8469            # If the directory doesn't exist, then chances are this is a new
    8570            # install of Python so don't create it since the user might end up
     
    9681    # Skip on wide unicode
    9782    if len(u'\0'.encode('unicode-internal')) == 4:
    98         raise test_support.TestSkipped("test_macostools is broken in USC4")
     83        raise unittest.SkipTest("test_macostools is broken in USC4")
    9984    test_support.run_unittest(TestMacostools)
    10085
Note: See TracChangeset for help on using the changeset viewer.