~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_osutils.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-09-01 08:02:42 UTC
  • mfrom: (5390.3.3 faster-revert-593560)
  • Revision ID: pqm@pqm.ubuntu.com-20100901080242-esg62ody4frwmy66
(spiv) Avoid repeatedly calling self.target.all_file_ids() in
 InterTree.iter_changes. (Andrew Bennetts)

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
 
28
28
from bzrlib import (
29
29
    errors,
 
30
    lazy_regex,
30
31
    osutils,
 
32
    symbol_versioning,
31
33
    tests,
32
34
    trace,
33
35
    win32utils,
861
863
        self.assertEqual('//HOST/path', osutils._win98_abspath('//HOST/path'))
862
864
        # relative path
863
865
        cwd = osutils.getcwd().rstrip('/')
864
 
        drive = osutils._nt_splitdrive(cwd)[0]
 
866
        drive = osutils.ntpath.splitdrive(cwd)[0]
865
867
        self.assertEqual(cwd+'/path', osutils._win98_abspath('path'))
866
868
        self.assertEqual(drive+'/path', osutils._win98_abspath('/path'))
867
869
        # unicode path
1705
1707
 
1706
1708
class TestReCompile(tests.TestCase):
1707
1709
 
 
1710
    def _deprecated_re_compile_checked(self, *args, **kwargs):
 
1711
        return self.applyDeprecated(symbol_versioning.deprecated_in((2, 2, 0)),
 
1712
            osutils.re_compile_checked, *args, **kwargs)
 
1713
 
1708
1714
    def test_re_compile_checked(self):
1709
 
        r = osutils.re_compile_checked(r'A*', re.IGNORECASE)
 
1715
        r = self._deprecated_re_compile_checked(r'A*', re.IGNORECASE)
1710
1716
        self.assertTrue(r.match('aaaa'))
1711
1717
        self.assertTrue(r.match('aAaA'))
1712
1718
 
1713
1719
    def test_re_compile_checked_error(self):
1714
1720
        # like https://bugs.launchpad.net/bzr/+bug/251352
 
1721
 
 
1722
        # Due to possible test isolation error, re.compile is not lazy at
 
1723
        # this point. We re-install lazy compile.
 
1724
        lazy_regex.install_lazy_compile()
1715
1725
        err = self.assertRaises(
1716
1726
            errors.BzrCommandError,
1717
 
            osutils.re_compile_checked, '*', re.IGNORECASE, 'test case')
 
1727
            self._deprecated_re_compile_checked, '*', re.IGNORECASE, 'test case')
1718
1728
        self.assertEqual(
1719
 
            "Invalid regular expression in test case: '*': "
1720
 
            "nothing to repeat",
 
1729
            'Invalid regular expression in test case: '
 
1730
            '"*" nothing to repeat',
1721
1731
            str(err))
1722
1732
 
1723
1733