~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_osutils.py

  • Committer: Robert Collins
  • Date: 2010-06-28 02:41:22 UTC
  • mto: This revision was merged to the branch mainline in revision 5324.
  • Revision ID: robertc@robertcollins.net-20100628024122-g951fzp74f3u6wst
Sanity check that new_trace_file in pop_log_file is valid, and also fix a test that monkey patched get_terminal_encoding.

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,
31
30
    osutils,
32
 
    symbol_versioning,
33
31
    tests,
34
32
    trace,
35
33
    win32utils,
863
861
        self.assertEqual('//HOST/path', osutils._win98_abspath('//HOST/path'))
864
862
        # relative path
865
863
        cwd = osutils.getcwd().rstrip('/')
866
 
        drive = osutils.ntpath.splitdrive(cwd)[0]
 
864
        drive = osutils._nt_splitdrive(cwd)[0]
867
865
        self.assertEqual(cwd+'/path', osutils._win98_abspath('path'))
868
866
        self.assertEqual(drive+'/path', osutils._win98_abspath('/path'))
869
867
        # unicode path
1707
1705
 
1708
1706
class TestReCompile(tests.TestCase):
1709
1707
 
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
 
 
1714
1708
    def test_re_compile_checked(self):
1715
 
        r = self._deprecated_re_compile_checked(r'A*', re.IGNORECASE)
 
1709
        r = osutils.re_compile_checked(r'A*', re.IGNORECASE)
1716
1710
        self.assertTrue(r.match('aaaa'))
1717
1711
        self.assertTrue(r.match('aAaA'))
1718
1712
 
1719
1713
    def test_re_compile_checked_error(self):
1720
1714
        # 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()
1725
1715
        err = self.assertRaises(
1726
1716
            errors.BzrCommandError,
1727
 
            self._deprecated_re_compile_checked, '*', re.IGNORECASE, 'test case')
 
1717
            osutils.re_compile_checked, '*', re.IGNORECASE, 'test case')
1728
1718
        self.assertEqual(
1729
 
            'Invalid regular expression in test case: '
1730
 
            '"*" nothing to repeat',
 
1719
            "Invalid regular expression in test case: '*': "
 
1720
            "nothing to repeat",
1731
1721
            str(err))
1732
1722
 
1733
1723