~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_osutils.py

  • Committer: Vincent Ladeuil
  • Date: 2016-01-21 10:50:35 UTC
  • mfrom: (6609 +trunk)
  • mto: This revision was merged to the branch mainline in revision 6610.
  • Revision ID: v.ladeuil+lp@free.fr-20160121105035-r67vcb49o142g2li
Merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005-2011 Canonical Ltd
 
1
# Copyright (C) 2005-2015 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
925
925
    """Test that _win32 versions of os utilities return appropriate paths."""
926
926
 
927
927
    def test_abspath(self):
 
928
        self.requireFeature(features.win32_feature)
928
929
        self.assertEqual('C:/foo', osutils._win32_abspath('C:\\foo'))
929
930
        self.assertEqual('C:/foo', osutils._win32_abspath('C:/foo'))
930
931
        self.assertEqual('//HOST/path', osutils._win32_abspath(r'\\HOST\path'))
943
944
                         osutils._win32_pathjoin('path/to', 'C:/foo'))
944
945
        self.assertEqual('path/to/foo',
945
946
                         osutils._win32_pathjoin('path/to/', 'foo'))
946
 
        self.assertEqual('/foo',
 
947
 
 
948
    def test_pathjoin_late_bugfix(self):
 
949
        if sys.version_info < (2, 7, 6):
 
950
            expected = '/foo'
 
951
        else:
 
952
            expected = 'C:/foo'
 
953
        self.assertEqual(expected,
947
954
                         osutils._win32_pathjoin('C:/path/to/', '/foo'))
948
 
        self.assertEqual('/foo',
 
955
        self.assertEqual(expected,
949
956
                         osutils._win32_pathjoin('C:\\path\\to\\', '\\foo'))
950
957
 
951
958
    def test_normpath(self):
971
978
        self.assertEqual('C:\\foo', osutils._win32_fixdrive('c:\\foo'))
972
979
 
973
980
    def test_win98_abspath(self):
 
981
        self.requireFeature(features.win32_feature)
974
982
        # absolute path
975
983
        self.assertEqual('C:/foo', osutils._win98_abspath('C:\\foo'))
976
984
        self.assertEqual('C:/foo', osutils._win98_abspath('C:/foo'))