You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by to...@apache.org on 2013/10/25 18:51:24 UTC
[1/2] git commit: Don't run "docs" target as part of the default tox
run.
Updated Branches:
refs/heads/trunk 160db53c0 -> 5aed65ddb
Don't run "docs" target as part of the default tox run.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/0e094bfd
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/0e094bfd
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/0e094bfd
Branch: refs/heads/trunk
Commit: 0e094bfdb5c7c1f6c10eb21d885aa1f013ea34cf
Parents: 160db53
Author: Tomaz Muraus <to...@apache.org>
Authored: Fri Oct 25 11:09:46 2013 +0200
Committer: Tomaz Muraus <to...@apache.org>
Committed: Fri Oct 25 11:09:46 2013 +0200
----------------------------------------------------------------------
tox.ini | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/0e094bfd/tox.ini
----------------------------------------------------------------------
diff --git a/tox.ini b/tox.ini
index 98d6832..79f97c9 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,5 +1,5 @@
[tox]
-envlist = py25,py26,py27,pypy,py32,py33,docs
+envlist = py25,py26,py27,pypy,py32,py33
setenv =
PIP_USE_MIRRORS=1
[2/2] git commit: Import LockTimeout before trying to catch it.
Posted by to...@apache.org.
Import LockTimeout before trying to catch it.
If lock.acquire raised any sort of exception, a NameError would
trump it because the __enter__ method was trying to catch
lockfile.LockTimeout, which wasn't imported.
Signed-off-by: Tomaz Muraus <to...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/5aed65dd
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/5aed65dd
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/5aed65dd
Branch: refs/heads/trunk
Commit: 5aed65ddbe186333080829e1e6f3c9d634112613
Parents: 0e094bf
Author: briancurtin <br...@rackspace.com>
Authored: Thu Oct 24 23:39:16 2013 -0500
Committer: Tomaz Muraus <to...@apache.org>
Committed: Fri Oct 25 18:46:29 2013 +0200
----------------------------------------------------------------------
libcloud/storage/drivers/local.py | 4 ++--
libcloud/test/storage/test_local.py | 12 ++++++++++++
2 files changed, 14 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/5aed65dd/libcloud/storage/drivers/local.py
----------------------------------------------------------------------
diff --git a/libcloud/storage/drivers/local.py b/libcloud/storage/drivers/local.py
index b8c20a1..fee53f7 100644
--- a/libcloud/storage/drivers/local.py
+++ b/libcloud/storage/drivers/local.py
@@ -25,7 +25,7 @@ import shutil
import sys
try:
- from lockfile import mkdirlockfile
+ from lockfile import LockTimeout, mkdirlockfile
except ImportError:
raise ImportError('Missing lockfile dependency, you can install it ' \
'using pip: pip install lockfile')
@@ -57,7 +57,7 @@ class LockLocalStorage(object):
def __enter__(self):
try:
self.lock.acquire(timeout=0.1)
- except lockfile.LockTimeout:
+ except LockTimeout:
raise LibcloudError('Lock timeout')
def __exit__(self, type, value, traceback):
http://git-wip-us.apache.org/repos/asf/libcloud/blob/5aed65dd/libcloud/test/storage/test_local.py
----------------------------------------------------------------------
diff --git a/libcloud/test/storage/test_local.py b/libcloud/test/storage/test_local.py
index bb70f38..dfd0cde 100644
--- a/libcloud/test/storage/test_local.py
+++ b/libcloud/test/storage/test_local.py
@@ -21,6 +21,8 @@ import shutil
import unittest
import tempfile
+import mock
+
from libcloud.utils.py3 import httplib
from libcloud.common.types import InvalidCredsError
@@ -35,6 +37,8 @@ from libcloud.storage.types import ObjectHashMismatchError
try:
from libcloud.storage.drivers.local import LocalStorageDriver
+ from libcloud.storage.drivers.local import LockLocalStorage
+ from lockfile import LockTimeout
except ImportError:
print('lockfile library is not available, skipping local_storage tests...')
LocalStorageDriver = None
@@ -318,6 +322,14 @@ class LocalTests(unittest.TestCase):
container.delete()
self.remove_tmp_file(tmppath)
+ @mock.patch("lockfile.mkdirlockfile.MkdirLockFile.acquire",
+ mock.MagicMock(side_effect=LockTimeout))
+ def test_proper_lockfile_imports(self):
+ # LockLocalStorage was previously using an un-imported exception
+ # in its __enter__ method, so the following would raise a NameError.
+ lls = LockLocalStorage("blah")
+ self.assertRaises(LibcloudError, lls.__enter__)
+
if not LocalStorageDriver:
class LocalTests(unittest.TestCase):