Merge lp:~luoyonggang/subvertpy/unittest-win32 into lp:~jelmer/subvertpy/trunk

Proposed by Yonggang Luo
Status: Merged
Approved by: Jelmer Vernooij
Approved revision: no longer in the source branch.
Merged at revision: 2437
Proposed branch: lp:~luoyonggang/subvertpy/unittest-win32
Merge into: lp:~jelmer/subvertpy/trunk
Diff against target: 51 lines (+19/-2)
1 file modified
subvertpy/tests/__init__.py (+19/-2)
To merge this branch: bzr merge lp:~luoyonggang/subvertpy/unittest-win32
Reviewer Review Type Date Requested Status
Jelmer Vernooij Approve
Review via email: mp+95141@code.launchpad.net

Commit message

A step to get unittest passed under win32. About the wrong file URL and can not remove read only files properly.

To post a comment you must log in.
Revision history for this message
Jelmer Vernooij (jelmer) wrote :

Do you know what creates these read-only files, and what files they are?

Revision history for this message
Jelmer Vernooij (jelmer) :
review: Needs Fixing
Revision history for this message
Jelmer Vernooij (jelmer) :
review: Needs Information
Revision history for this message
Yonggang Luo (luoyonggang) wrote :

Information is already there,
At this URL

https://bugs.launchpad.net/subvertpy/+bug/943131

2012/2/29 Jelmer Vernooij <email address hidden>

> Review: Needs Information
>
>
> --
>
> https://code.launchpad.net/~luoyonggang/subvertpy/unittest-win32/+merge/95141
> You are the owner of lp:~luoyonggang/subvertpy/unittest-win32.
>

--
         此致

罗勇刚
Yours
    sincerely,
Yonggang Luo

Revision history for this message
Yonggang Luo (luoyonggang) wrote :

It's subversion get those files be read only.
That's make sense because those won't be modified except svn. So they
were set to be read only. But on windows, we can not remove read only
files directly.

2012/2/29, Jelmer Vernooij <email address hidden>:
> Do you know what creates these read-only files, and what files they are?
> --
> https://code.launchpad.net/~luoyonggang/subvertpy/unittest-win32/+merge/95141
> You are the owner of lp:~luoyonggang/subvertpy/unittest-win32.
>

--
从我的移动设备发送

         此致

罗勇刚
Yours
    sincerely,
Yonggang Luo

2435. By Jelmer Vernooij

Only use build_with_dlls on windows.

2436. By Jelmer Vernooij

Merge support for always closing files, with tweaks.

Revision history for this message
Jelmer Vernooij (jelmer) :
review: Approve
2437. By Jelmer Vernooij

Merge fix to remove readonly files on Windows.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'subvertpy/tests/__init__.py'
2--- subvertpy/tests/__init__.py 2011-11-08 14:41:55 +0000
3+++ subvertpy/tests/__init__.py 2012-02-29 10:23:18 +0000
4@@ -22,6 +22,7 @@
5 from cStringIO import StringIO
6 import os
7 import shutil
8+import stat
9 import sys
10 import tempfile
11 import unittest
12@@ -48,6 +49,22 @@
13 )
14
15
16+def force_rm_handle(remove_path, path, excinfo):
17+ os.chmod(
18+ path,
19+ os.stat(path).st_mode | stat.S_IWUSR | stat.S_IWGRP | stat.S_IWOTH
20+ )
21+ remove_path(path)
22+
23+
24+def rmtree(path):
25+ """In Windows a read-only file cannot be removed, and shutil.rmtree fails.
26+ So we implement our own version of rmtree to address this issue.
27+ """
28+ if os.path.exists(path):
29+ shutil.rmtree(path, onerror=lambda func, path, e: force_rm_handle(func, path, e))
30+
31+
32 class TestCase(unittest.TestCase):
33 """Base test case.
34
35@@ -81,7 +98,7 @@
36 def tearDown(self):
37 TestCase.tearDown(self)
38 os.chdir(self._oldcwd)
39- shutil.rmtree(self.test_dir)
40+ rmtree(self.test_dir)
41
42
43 class TestFileEditor(object):
44@@ -230,7 +247,7 @@
45 os.chmod(revprop_hook, os.stat(revprop_hook).st_mode | 0111)
46
47 if sys.platform == 'win32':
48- return "file://%s" % abspath.replace("\\", "/")
49+ return "file:///%s" % abspath.replace("\\", "/")
50 else:
51 return "file://%s" % abspath
52

Subscribers

People subscribed via source and target branches

to all changes: