[VOL-2241] Python 3 refactor of pyvoltha
Majority of work was manual fixes to bytes and strings types, which are
different in py3, but same in py2. As the OMCI library does a lot of
these comparisons and scapy then renders packets, this was frequently
nontrival to debug.
Also:
- Removed grpc dep which wasn't being used, not py3 compatible
- s/Alarms/Events/ to work with protobuf changes per VOL-2224
- Automatic fixes via modernize tooling
- Removed unused OrderedWeakValueDict code
- Removed frameio send_frame specific to Darwin (MacOS), which had no
corresponding linux code
- Use library functions for hex and unicode conversions
- Various other cleanups and fixes (EOL whitespace, etc.)
Also more (Matt):
- handle stringify better, check if already string
- use binary string for binary work
- import new thread paths
- update requirements.txt for newer libraries needed with newer python
- return proper tuple for unpacking
- bytes string formatting fixed
- fix mock task unit test
Even more (Zack):
- Python 2/3 compat for _thread by using 'future'
- Bump version to 2.3.0
Change-Id: I53b596d374a944bfb80d0b112f21bcc1f8bcee6e
diff --git a/test/unit/common/test_event_bus.py b/test/unit/common/test_event_bus.py
index be325e8..c833bf0 100644
--- a/test/unit/common/test_event_bus.py
+++ b/test/unit/common/test_event_bus.py
@@ -13,6 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
+from __future__ import absolute_import
import re
from mock import Mock
@@ -21,6 +22,7 @@
from twisted.trial.unittest import TestCase
from pyvoltha.common.event_bus import EventBusClient, EventBus
+from six.moves import range
class TestEventBus(TestCase):
@@ -187,11 +189,11 @@
ebc.subscribe('', lambda _, msg: queue.put(msg))
- for i in xrange(10):
+ for i in range(10):
ebc.publish('', i)
self.assertEqual(len(queue.pending), 10)
- for i in xrange(10):
+ for i in range(10):
msg = yield queue.get()
self.assertEqual(msg, i)
self.assertEqual(len(queue.pending), 0)