/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_osutils.py

  • Committer: John Arbash Meinel
  • Date: 2008-07-17 20:16:43 UTC
  • mto: This revision was merged to the branch mainline in revision 3560.
  • Revision ID: john@arbash-meinel.com-20080717201643-qrbe6thvki1izwig
Switch from os.name to bzrlib.win32utils.winver.
os.name is always 'nt' for any Windows platform... :(

Show diffs side-by-side

added added

removed removed

Lines of Context:
842
842
                          osutils._real_walkdirs_utf8)
843
843
 
844
844
    def _save_platform_info(self):
845
 
        cur_platform = sys.platform
846
 
        cur_os_name = os.name
 
845
        cur_winver = win32utils.winver
847
846
        cur_fs_enc = osutils._fs_enc
848
847
        cur_real_walkdirs_utf8 = osutils._real_walkdirs_utf8
849
848
        def restore():
850
 
            sys.platform = cur_platform
851
 
            os.name = cur_os_name
 
849
            win32utils.winver = cur_winver
852
850
            osutils._fs_enc = cur_fs_enc
853
851
            osutils._real_walkdirs_utf8 = cur_real_walkdirs_utf8
854
852
        self.addCleanup(restore)
863
861
 
864
862
    def test_force_walkdirs_utf8_fs_utf8(self):
865
863
        self._save_platform_info()
866
 
        sys.platform = 'not-win32' # Avoid the win32 detection code
 
864
        win32utils.winver = None # Avoid the win32 detection code
867
865
        osutils._fs_enc = 'UTF-8'
868
866
        self.assertWalkdirsUtf8Is(osutils._walkdirs_fs_utf8)
869
867
 
870
868
    def test_force_walkdirs_utf8_fs_ascii(self):
871
869
        self._save_platform_info()
872
 
        sys.platform = 'not-win32' # Avoid the win32 detection code
 
870
        win32utils.winver = None # Avoid the win32 detection code
873
871
        osutils._fs_enc = 'US-ASCII'
874
872
        self.assertWalkdirsUtf8Is(osutils._walkdirs_fs_utf8)
875
873
 
876
874
    def test_force_walkdirs_utf8_fs_ANSI(self):
877
875
        self._save_platform_info()
878
 
        sys.platform = 'not-win32' # Avoid the win32 detection code
 
876
        win32utils.winver = None # Avoid the win32 detection code
879
877
        osutils._fs_enc = 'ANSI_X3.4-1968'
880
878
        self.assertWalkdirsUtf8Is(osutils._walkdirs_fs_utf8)
881
879
 
882
880
    def test_force_walkdirs_utf8_fs_latin1(self):
883
881
        self._save_platform_info()
884
 
        sys.platform = 'not-win32' # Avoid the win32 detection code
 
882
        win32utils.winver = None # Avoid the win32 detection code
885
883
        osutils._fs_enc = 'latin1'
886
884
        self.assertWalkdirsUtf8Is(osutils._walkdirs_unicode_to_utf8)
887
885
 
888
886
    def test_force_walkdirs_utf8_nt(self):
889
887
        self.requireFeature(WalkdirsWin32Feature)
890
888
        self._save_platform_info()
891
 
        sys.platform = 'win32'
892
 
        os.name = 'nt'
 
889
        win32utils.winver = 'Windows NT'
893
890
        from bzrlib._walkdirs_win32 import _walkdirs_utf8_win32_find_file
894
891
        self.assertWalkdirsUtf8Is(_walkdirs_utf8_win32_find_file)
895
892
 
896
893
    def test_force_walkdirs_utf8_nt(self):
897
894
        self.requireFeature(WalkdirsWin32Feature)
898
895
        self._save_platform_info()
899
 
        sys.platform = 'win32'
900
 
        os.name = 'NOT-nt'
 
896
        win32utils.winver = 'Windows 98'
901
897
        self.assertWalkdirsUtf8Is(osutils._walkdirs_unicode_to_utf8)
902
898
 
903
899
    def test_unicode_walkdirs(self):