Retry code throws "TypeError: 'Retrying' object is not iterable"
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Snap Layer |
Fix Committed
|
Undecided
|
Liam Young |
Bug Description
Since 2f49ae75 the retry code is broken as the old version of tenacity does not support using tenacity.Retrying as an iterator
To reproduce it:
$ virtualenv /tmp/layer-
$ source /tmp/layer-
$ pip install 'tenacity<5.0.4'
$ ./test.py
Traceback (most recent call last):
File "./test.py", line 5, in <module>
for attempt in tenacity.
TypeError: 'Retrying' object is not iterable
$ cat ./test.py
#!/usr/bin/env python
import tenacity
for attempt in tenacity.
with attempt:
$ pip uninstall tenacity
Found existing installation: tenacity 5.0.3
Uninstalling tenacity-5.0.3:
Would remove:
/tmp/
/tmp/
Proceed (y/n)? y
Successfully uninstalled tenacity-5.0.3
$ pip install tenacity
Collecting tenacity
Using cached tenacity-
Requirement already satisfied: six>=1.9.0 in ./layer-
Installing collected packages: tenacity
Successfully installed tenacity-7.0.0
$ ./test.py
Hi!
Related branches
- Tom Haddon: Approve
- Cory Johns (community): Approve
- Aurelien Lourot (community): Approve
-
Diff: 49 lines (+19/-16)1 file modifiedlib/charms/layer/snap.py (+19/-16)
Changed in layer-snap: | |
status: | Confirmed → Fix Committed |
assignee: | nobody → Liam Young (gnuoy) |
$ git diff 2f49ae75^ 2f49ae75
diff --git a/wheelhouse.txt b/wheelhouse.txt
index 48f8e12..f9bf12c 100644
--- a/wheelhouse.txt
+++ b/wheelhouse.txt
@@ -1 +1,4 @@
-tenacity
+# Newer versions of tenacity rely on `typing` which is in stdlib in
+# python3.5 but not python3.4. We want to continue to support
+# python3.4 (Trusty)
+tenacity<5.0.4