openwisp / netengine

Python abstraction layer for extracting information from network devices.
http://netengine.rtfd.org
Other
39 stars 17 forks source link

[misc] Python3 support, Github CI and QA Checks #59

Closed purhan closed 3 years ago

purhan commented 3 years ago

Closes #50, closes #49, closes #52, closes #55, closes #61

purhan commented 3 years ago

image @nemesisdesign @pandafy The build is showing this error.

This is an issue with mock library and is fixed in python 3.8. Should we use python 3.8, or look for a workaround?

pandafy commented 3 years ago

This is an issue with mock library and is fixed in python 3.8. Should we use python 3.8, or look for a workaround?

We should look for a workaround for now since rest of OpenWISP currently supports Python 3.6 and 3.7. A possible workaround will be to catch the RuntimeError in tearDown:

diff --git a/tests/test_snmp/test_airos.py b/tests/test_snmp/test_airos.py
index 56234d0..fc190e2 100644
--- a/tests/test_snmp/test_airos.py
+++ b/tests/test_snmp/test_airos.py
@@ -168,4 +168,7 @@ class TestSNMPAirOS(unittest.TestCase, MockOutputMixin):
         self.assertIsInstance(self.device.uptime_tuple, tuple)

     def tearDown(self):
-        self.getcmd_patcher.stop()
+        try:
+            self.getcmd_patcher.stop()
+        except RuntimeError:
+            return

Don't forget to add a comment stating why this has been done and to remove it once support for Python 3.8 an above is added.

purhan commented 3 years ago

Note: We have to configure the coveralls bot to comment on PRs.