861
863
self.assertEqual('//HOST/path', osutils._win98_abspath('//HOST/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'))
1706
1708
class TestReCompile(tests.TestCase):
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)
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'))
1713
1719
def test_re_compile_checked_error(self):
1714
1720
# like https://bugs.launchpad.net/bzr/+bug/251352
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',