#8725 closed defect (fixed)
Test env.get_known_users broken on Vista by r8635
| Reported by: | Christian Boos | Owned by: | Christian Boos |
|---|---|---|---|
| Priority: | high | Milestone: | 0.11.6 |
| Component: | general | Version: | 0.11-stable |
| Severity: | normal | Keywords: | rename |
| Cc: | Branch: | ||
| Release Notes: | |||
| API Changes: | |||
| Internal Changes: | |||
Description
Traceback (most recent call last):
File "C:\Workspace\src\trac\repos\trunk\trac\tests\env.py", line 15, in setUp
self.env = Environment(env_path, create=True)
File "C:\Workspace\src\trac\repos\trunk\trac\env.py", line 206, in __init__
self.create(options)
File "C:\Workspace\src\trac\repos\trunk\trac\env.py", line 330, in create
self.config.save()
File "C:\Workspace\src\trac\repos\trunk\trac\config.py", line 226, in save
fileobj.close()
File "C:\Workspace\src\trac\repos\trunk\trac\util\__init__.py", line 174, in commit
rename(self._temp, self._path)
File "C:\Workspace\src\trac\repos\trunk\trac\util\__init__.py", line 108, in rename
raise ctypes.WinError()
WindowsError: [Error 6700] The transaction handle associated with this operation is not valid.
I didn't notice it at first because the Python version I preferably use for running the tests on 0.11-stable doesn't have ctypes…
Attachments (0)
Change History (9)
comment:1 by , 16 years ago
follow-ups: 3 4 comment:2 by , 16 years ago
All tests passed when I used Python 2.3.5 which doesn't have ctypes, but I don't think we have a test for exercising the rename to an opened file, do we?
follow-up: 6 comment:3 by , 16 years ago
Replying to cboos:
All tests passed when I used Python 2.3.5 which doesn't have ctypes, but I don't think we have a test for exercising the rename to an opened file, do we?
Scratch that, now it doesn't. I was probably only testing my stuff (r8644) and was not up to date…
So yes, without ctypes it also fails, but differently of course:
ERROR: test_set_and_save (trac.tests.config.ConfigurationTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Workspace\src\trac\repos\trunk\trac\tests\config.py", line 173, in test_set_and_save
config.save()
File "C:\Workspace\src\trac\repos\trunk\trac\config.py", line 226, in save
fileobj.close()
File "C:\Workspace\src\trac\repos\trunk\trac\util\__init__.py", line 174, in commit
rename(self._temp, self._path)
File "C:\Workspace\src\trac\repos\trunk\trac\util\__init__.py", line 123, in rename
os.rename(src, dst)
OSError: [Errno 17] File exists
======================================================================
ERROR: test_set_and_save_inherit (trac.tests.config.ConfigurationTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Workspace\src\trac\repos\trunk\trac\tests\config.py", line 221, in test_set_and_save_in
self._test_with_inherit(testcb)
File "C:\Workspace\src\trac\repos\trunk\trac\tests\config.py", line 334, in _test_with_inherit
testcb()
File "C:\Workspace\src\trac\repos\trunk\trac\tests\config.py", line 203, in testcb
config.save()
File "C:\Workspace\src\trac\repos\trunk\trac\config.py", line 226, in save
fileobj.close()
File "C:\Workspace\src\trac\repos\trunk\trac\util\__init__.py", line 174, in commit
rename(self._temp, self._path)
File "C:\Workspace\src\trac\repos\trunk\trac\util\__init__.py", line 123, in rename
os.rename(src, dst)
OSError: [Errno 17] File exists
======================================================================
ERROR: Testing env.get_known_users
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Workspace\src\trac\repos\trunk\trac\tests\env.py", line 15, in setUp
self.env = Environment(env_path, create=True)
File "C:\Workspace\src\trac\repos\trunk\trac\env.py", line 206, in __init__
self.create(options)
File "C:\Workspace\src\trac\repos\trunk\trac\env.py", line 330, in create
self.config.save()
File "C:\Workspace\src\trac\repos\trunk\trac\config.py", line 226, in save
fileobj.close()
File "C:\Workspace\src\trac\repos\trunk\trac\util\__init__.py", line 174, in commit
rename(self._temp, self._path)
File "C:\Workspace\src\trac\repos\trunk\trac\util\__init__.py", line 123, in rename
os.rename(src, dst)
OSError: [Errno 17] File exists
follow-up: 5 comment:4 by , 16 years ago
Replying to cboos:
I don't think we have a test for exercising the rename to an opened file, do we?
No, I was referring to comment:17:ticket:8623.
About the failures in comment:3, this is strange. I thought I had run the test suite on Windows with ctypes disabled, but I must have missed something… I'll check tonight.
comment:5 by , 16 years ago
Replying to rblank:
Replying to cboos:
I don't think we have a test for exercising the rename to an opened file, do we?
No, I was referring to comment:17:ticket:8623.
Well, there I only tested the rename() function alone, in a python shell.
comment:6 by , 16 years ago
| Owner: | set to |
|---|
Replying to cboos:
Scratch that, now it doesn't. I was probably only testing my stuff (r8644) and was not up to date…
This should be fixed in [8648]. It seems that Python 2.3 raised an OSError instead of a WindowsError when the rename destination existed. I have also added some basic unit tests for AtomicFile.
I'm still trying to get access to a Vista box for the initial issue.
follow-up: 9 comment:7 by , 16 years ago
Got it ;-)
After creating the transaction, ta was -1, and raising a ctypes.WinError() right after that displayed: WindowsError: [Error 87] The parameter is incorrect.
The parameter in question was the last one, which was probably too long or contained illegal characters or whatnot. When using the same message but only the basename of the files, it worked.
comment:8 by , 16 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
For the final change [8650], I used a fixed description 'Trac forced rename' - as that should be always fine.
comment:9 by , 16 years ago
| Owner: | changed from to |
|---|



Mmh… Does that mean you were able to replace an open file with the default compatibility code?