Repository :
http://git.fedorahosted.org/cgit/copr.git
On branch : master
---------------------------------------------------------------
commit 0f3325606d1f48de2b456c355e08c5bdad1f59b8
Author: Valentin Gologuzov <vgologuz(a)redhat.com>
Date: Fri Oct 24 12:01:05 2014 +0200
[backend] stupid bug with Lock object and context manager
---------------------------------------------------------------
backend/backend/createrepo.py | 2 +-
backend/tests/test_action.py | 4 ----
backend/tests/test_createrepo.py | 4 ++--
3 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/backend/backend/createrepo.py b/backend/backend/createrepo.py
index 5d73436..6673be4 100644
--- a/backend/backend/createrepo.py
+++ b/backend/backend/createrepo.py
@@ -44,7 +44,7 @@ def createrepo_unsafe(path, lock=None, dest_dir=None, base_url=None):
comm.append(path)
if lock:
- with lock.acquire():
+ with lock:
cmd = Popen(comm, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, err = cmd.communicate()
else:
diff --git a/backend/tests/test_action.py b/backend/tests/test_action.py
index 05b3429..e618676 100644
--- a/backend/tests/test_action.py
+++ b/backend/tests/test_action.py
@@ -387,7 +387,6 @@ class TestAction(object):
"Running createrepo",
"Package bar dir not found in chroot fedora20",
"Running createrepo",
-
])
ev = self.test_q.get_nowait()
@@ -405,8 +404,6 @@ class TestAction(object):
assert_what_from_queue(self.test_q, msg_list=["In chroot epel7"])
assert_epel7()
-
-
with pytest.raises(EmptyQueue):
self.test_q.get_nowait()
@@ -456,7 +453,6 @@ class TestAction(object):
assert error_event_recorded
-
def assert_what_from_queue(q, msg_list, who="action"):
for msg in msg_list:
ev = q.get_nowait()
diff --git a/backend/tests/test_createrepo.py b/backend/tests/test_createrepo.py
index bd6db31..088c5c8 100644
--- a/backend/tests/test_createrepo.py
+++ b/backend/tests/test_createrepo.py
@@ -90,8 +90,8 @@ class TestCreaterepoUnsafe(object):
self.shared_state["lock_status"] =
copy.copy(self.shared_state["in_lock"])
return mock.DEFAULT
- mocked_lock.acquire.return_value.__enter__.side_effect = enter_lock
- mocked_lock.acquire.return_value.__exit__.side_effect = exit_lock
+ mocked_lock.__enter__.side_effect = enter_lock
+ mocked_lock.__exit__.side_effect = exit_lock
mc_popen.side_effect = popen_side_effect
mc_popen.return_value.communicate.return_value = ("", "")