netdsa/dsatest

Minor python2.7 compatibility problem

Closed this issue · 2 comments

Python 2.7 is choking on the following:

`----------------------------------------------------------------------
....FF.....ss

FAIL: test_sanity_interface_check_attributes (tests.sanity.TestSanity)

Traceback (most recent call last):
File "/home/florian/dev/github/dsatest/tests/sanity.py", line 42, in test_sanity_interface_check_attributes
self.assertIsInstance(interface.name, str)
AssertionError: u'lan1' is not an instance of <type 'str'>

======================================================================
FAIL: test_sanity_interface_check_name_is_set (tests.sanity.TestSanity)

Traceback (most recent call last):
File "/home/florian/dev/github/dsatest/tests/sanity.py", line 53, in test_sanity_interface_check_name_is_set
self.assertIsInstance(host, str)
AssertionError: u'enp15s0f0' is not an instance of <type 'str'>


Ran 13 tests in 0.006s

FAILED (failures=2, skipped=2)
zsh: exit 2 ./dsatest --dry-run -t sanity -B bench.cfg
`

d-k-c commented

That can be easily fixed with some compatibility modules like future

d-k-c commented

I addressed that with the six compatibility module in ff1c500, along with the TimeoutError that I recently introduced which is a Python3-only exception. I replaced it with a RuntimeException, which is available in both versions. Let me know if there are other issues.