Edgewall Software
Modify

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#12776 closed defect (fixed)

Tests fail with Subversion 1.6 or early: WindowsError: [Error 5] Access is denied

Reported by: anonymous Owned by: Jun Omae
Priority: normal Milestone: 1.0.14
Component: admin/console Version:
Severity: minor Keywords:
Cc: Branch:
Release Notes:

Use rmtree rather than shutil.rmtree to fix os.remove failing for read-only files on Windows while running unit-test.

API Changes:

Move rmtree from trac.tests.compat to trac.test.

Internal Changes:

Description

C:\Trac>svn checkout https://svn.edgewall.org/repos/trac/trunk
C:\Trac>python trac\admin\tests\console.py
SKIP: trac.admin.tests.console.TracAdminComponentTestCase (__name__ is not trac.admin.tests.console)
................................................................E.
======================================================================
ERROR: test_deploy (__main__.TracAdminDeployTestCase)
Deploy into valid target directory.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "trac\admin\tests\console.py", line 849, in tearDown
    shutil.rmtree(self.env.path)
  File "c:\Python27\Lib\shutil.py", line 247, in rmtree
    rmtree(fullname, ignore_errors, onerror)
  File "c:\Python27\Lib\shutil.py", line 247, in rmtree
    rmtree(fullname, ignore_errors, onerror)
  File "c:\Python27\Lib\shutil.py", line 247, in rmtree
    rmtree(fullname, ignore_errors, onerror)
  File "c:\Python27\Lib\shutil.py", line 247, in rmtree
    rmtree(fullname, ignore_errors, onerror)
  File "c:\Python27\Lib\shutil.py", line 252, in rmtree
    onerror(os.remove, fullname, sys.exc_info())
  File "c:\Python27\Lib\shutil.py", line 250, in rmtree
    os.remove(fullname)
WindowsError: [Error 5] Access is denied: 'c:\\users\\joe\\appdata\\local\\temp\\trac-testdir-gnhitw\\www\\htdocs\\common\\.svn\\all-wcprops'

----------------------------------------------------------------------
Ran 66 tests in 7.113s

FAILED (errors=1)

Should deploy also copy the .svn folders?

It works after upgrading C:\Trac SVN checkout from to SVN 1.8 working copy format, where only C:\Trac\.svn folder exists, not C:\TracSVN\trac\htdocs\.svn.

Attachments (0)

Change History (9)

comment:1 by anonymous, 8 years ago

Type: enhancementdefect

comment:2 by anonymous, 8 years ago

#8278 was the same error.

comment:3 by Jun Omae, 8 years ago

Component: generaladmin/console
Severity: normalminor
Summary: Tests fail with old SVN: WindowsError: [Error 5] Access is denied: 'c:\\users\\joe\\appdata\\local\\temp\\trac-testdir-gnhitw\\www\\htdocs\\common\\.svn\\all-wcprops'Tests fail with Subversion 1.6 or early: WindowsError: [Error 5] Access is denied

comment:4 by Jun Omae, 8 years ago

Milestone: 1.0.14
Owner: set to Jun Omae
Status: newassigned

os.remove() doesn't work for read-only files on Windows. I consider we could always use rmtree in trac.tests.compat rather than shutil.rmtree.

comment:5 by Ryan J Ollos, 8 years ago

It might make sense to move rmtree from trac.tests.compat to trac.test. It was moved there in r12247, but when I look now it seems like an odd place to have placed the function.

Should shutil.rmtree in reset_db_and_disk also be replaced with rmtree?: tags/trac-1.2.1/trac/test.py@:487#L479.

Last edited 8 years ago by Ryan J Ollos (previous) (diff)

in reply to:  5 comment:6 by Jun Omae, 8 years ago

Replying to Ryan J Ollos:

It might make sense to move rmtree from trac.tests.compat to trac.test. It was moved there in r12247, but when I look now it seems like an odd place to have placed the function.

I agree.

Should shutil.rmtree in reset_db_and_disk also be replaced with rmtree?: tags/trac-1.2.1/trac/test.py@:487#L479.

Ah. I missed it.

Revised 3 branches with your suggestions.

comment:7 by Ryan J Ollos, 8 years ago

Looks good to me. Thanks for fixing location of rmtree.

comment:8 by Jun Omae, 8 years ago

API Changes: modified (diff)
Release Notes: modified (diff)
Resolution: fixed
Status: assignedclosed

Thanks for the reviewing. Committed in [15799-15801].

comment:9 by Ryan J Ollos, 8 years ago

Spotted a few additional imports that needed modifying while rebasing the python3 branch: r15802, r15803.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Jun Omae.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Jun Omae to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.