Skip to content

Commit

Permalink
Merge pull request #182 from ClusterHQ/fix-tests-on-vagrant-111
Browse files Browse the repository at this point in the history
Missing review fixes from #173.
  • Loading branch information
tomprince committed Jul 1, 2014
2 parents ff296fe + 909e7a7 commit b3c6aaf
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions flocker/testtools.py
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ def find_free_port(interface='127.0.0.1', socket_family=socket.AF_INET,
def skip_on_broken_permissions(test_method):
"""
Skips the wrapped test when the temporary directory is on a
virtualbox shared folder.
filesystem with broken permissions.
Virtualbox's shared folder (as used for :file:`/vagrant`) doesn't entirely
respect changing permissions. For example, this test detects running on a
Expand All @@ -536,6 +536,8 @@ def skip_on_broken_permissions(test_method):
:param callable test_method: Test method to wrap.
:return: The wrapped method.
:raise SkipTest: when the temporary directory is on a filesystem with
broken permissions.
"""
@wraps(test_method)
def wrapper(case, *args, **kwargs):
Expand All @@ -545,6 +547,7 @@ def wrapper(case, *args, **kwargs):
permissions = test_file.getPermissions()
test_file.chmod(0o777)
if permissions != Permissions(0o000):
raise SkipTest("Can't run test on virtualbox shared folder.")
raise SkipTest(
"Can't run test on filesystem with broken permissions.")
return test_method(case, *args, **kwargs)
return wrapper

0 comments on commit b3c6aaf

Please sign in to comment.