Skip to content

Fix SandboxTest.setUp() in case gh.git_repo() fails with a server error#115

Merged
joshmoore merged 1 commit intoome:masterfrom
sbesson:sandbox_cleanup
Nov 1, 2013
Merged

Fix SandboxTest.setUp() in case gh.git_repo() fails with a server error#115
joshmoore merged 1 commit intoome:masterfrom
sbesson:sandbox_cleanup

Conversation

@sbesson
Copy link
Copy Markdown
Member

@sbesson sbesson commented Oct 31, 2013

If gh.git_repo() fails due to e.g. a server error, this commit ensures we return to the initial folder instead of staying in a deleted folder

To test this PR:
see http://hudson.openmicroscopy.org.uk/view/Failing/job/SCC-self-merge/142/console
we shouldn't get any

======================================================================
ERROR: testDeployInitBrokenSymlink (test.unit.TestDeploy.TestDeploy)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/omero/slave/workspace/SCC-self-merge/snoopycrimecop/test/unit/TestDeploy.py", line 33, in setUp
    self.folder = os.path.abspath("deploy_test")
  File "/home/omero/slave/workspace/SCC-self-merge/virtualenv/lib/python2.6/posixpath.py", line 343, in abspath
    cwd = os.getcwd()
OSError: [Errno 2] No such file or directory

error if SandboxTest.setUp()` fails

If gh.git_repo() fails due to e.g. a server error, this commit ensures
we return to the initial folder instead of staying in a deleted folder
@joshmoore
Copy link
Copy Markdown
Member

Who/what performed the os.chdir here? rmtree itself?

@sbesson
Copy link
Copy Markdown
Member Author

sbesson commented Nov 1, 2013

No, I think the chdir comes from the __init__() method of GitRepository. There is a self.cd(path) which comes before the GH origin is queried.

@joshmoore
Copy link
Copy Markdown
Member

Hmmmm.... that seems dangerous. Maybe we should remove all calls to os.chdir except via decorators.

@joshmoore
Copy link
Copy Markdown
Member

If that larger change needs to wait until after 0.4.1, then 👍 for this.

@sbesson
Copy link
Copy Markdown
Member Author

sbesson commented Nov 1, 2013

If this PR doesn't harm, let's merge it maybe and then open an issue for the chdir decorators across all relevant GitRepository methods.

@joshmoore
Copy link
Copy Markdown
Member

Issue created. Merging.

joshmoore added a commit that referenced this pull request Nov 1, 2013
Fix SandboxTest.setUp() in case gh.git_repo() fails with a server error
@joshmoore joshmoore merged commit a062aa3 into ome:master Nov 1, 2013
@sbesson sbesson deleted the sandbox_cleanup branch November 1, 2013 09:21
joshmoore added a commit to joshmoore/scc that referenced this pull request Aug 29, 2018
joshmoore added a commit to joshmoore/scc that referenced this pull request Aug 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants