diff options
author | W. Trevor King <wking@drexel.edu> | 2009-07-31 05:24:05 -0400 |
---|---|---|
committer | W. Trevor King <wking@drexel.edu> | 2009-07-31 05:24:05 -0400 |
commit | 3c4ce1b4519186007f2568569b1bff55cdbb108f (patch) | |
tree | 478f66bab1da7d30f1036254f020b6b618b17d85 /libbe/bugdir.py | |
parent | 11d3b00bf4c12446dafeb3cfde9d0ae40608a85d (diff) | |
download | bugseverywhere-3c4ce1b4519186007f2568569b1bff55cdbb108f.tar.gz |
Return to original directory after libbe.bugdir.SimpleBugDirTestCase().
This was causing strange "RCS not found" errors in the bzr and hg
unittests. For example, the bzr tests all passed:
wking@thor:be.wtk-rr$ python test.py bzr
...
Ran 12 tests in 24.143s
OK
Except when run after the bugdir tests:
wking@thor:be.wtk-rr$ python test.py bugdir bzr
...
Ran 19 tests in 1.862s
FAILED (errors=12)
Where the failures were all
AssertionError: bzr RCS not found
Fixed by returning to intial directory after SimpleBugDirTestCase
execution. Problem is due to Python issues with unlinked directories
though, so bzr/hg will _still_ not work from unlinked directories.
This is for Python 2.5.4 on Ubuntu 8.04.3, but probably effects other
pythons too.
Details:
Isolated problem to unlinked directories:
mkdir /tmp/a
cd /tmp/a
rmdir /tmp/a
python /home/wking/src/fun/be/be.wtk-rr/test.py bzr
which fails with the same "RCS not found" errors because bzr fails:
wking@thor:/$ mkdir /tmp/a; cd /tmp/a; rmdir /tmp/a; bzr --help; cd /;
rmdir: removing directory, /tmp/a
'import site' failed; use -v for traceback
bzr: ERROR: Couldn't import bzrlib and dependencies.
Please check bzrlib is on your PYTHONPATH.
Traceback (most recent call last):
File "/usr/bin/bzr", line 64, in <module>
import bzrlib
ImportError: No module named bzrlib
which fails becase 'import site' fails:
wking@thor:/$ mkdir /tmp/a; cd /tmp/a; rmdir /tmp/a; python -c 'import site'; cd /;
rmdir: removing directory, /tmp/a
'import site' failed; use -v for traceback
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/wking/lib/python/site.py", line 73, in <module>
__boot()
File "/home/wking/lib/python/site.py", line 33, in __boot
imp.load_module('site',stream,path,descr)
File "/usr/lib/python2.5/site.py", line 408, in <module>
main()
File "/usr/lib/python2.5/site.py", line 392, in main
paths_in_sys = removeduppaths()
File "/usr/lib/python2.5/site.py", line 96, in removeduppaths
dir, dircase = makepath(dir)
File "/usr/lib/python2.5/site.py", line 72, in makepath
dir = os.path.abspath(os.path.join(*paths))
File "/usr/lib/python2.5/posixpath.py", line 403, in abspath
path = join(os.getcwd(), path)
OSError: [Errno 2] No such file or directory
which fails because our cwd doesn't exist. That makes sense ;).
Still I think Python should be able to handle it, so I reported it
http://bugs.python.org/issue6612
Diffstat (limited to 'libbe/bugdir.py')
-rw-r--r-- | libbe/bugdir.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/libbe/bugdir.py b/libbe/bugdir.py index 8ec5a31..0bcf27e 100644 --- a/libbe/bugdir.py +++ b/libbe/bugdir.py @@ -760,12 +760,14 @@ class SimpleBugDirTestCase (unittest.TestCase): def setUp(self): # create a pre-existing bugdir in a temporary directory self.dir = utility.Dir() + self.original_working_dir = os.getcwd() os.chdir(self.dir.path) self.bugdir = BugDir(self.dir.path, sink_to_existing_root=False, allow_rcs_init=True) self.bugdir.new_bug("preexisting", summary="Hopefully not imported") self.bugdir.save() def tearDown(self): + os.chdir(self.original_working_dir) self.dir.cleanup() def testOnDiskCleanLoad(self): """simple_bug_dir(sync_with_disk==True) should not import preexisting bugs.""" |