You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Platform API][pytest] Handle both 'str' and 'unicode' string types in Python 2 (#2210)
Python 2 has two string types, `str` and `unicode`. Both share a `basestring` superclass. In Python 3, there is only one `str` type. This patch allows the platform API tests to consider a string type valid whether it is ASCII (`str`) or Unicode in Python 2. It also future-proofs the inevitable transition to Python 3 by checking the executing Python version.
Note that test_chassis.py is not modified here, as the change is being applied as part of #2209
avail_fw_version=component.get_available_firmware_version(platform_api_conn, i, image)
128
139
ifself.expect(avail_fw_versionisnotNone, "Component {}: Failed to retrieve available firmware version from image {}".format(i, image)):
129
-
self.expect(isinstance(avail_fw_version, str), "Component {}: Available Firmware version appears to be incorrect from image {}".format(i, image))
140
+
self.expect(isinstance(avail_fw_version, STRING_TYPE), "Component {}: Available Firmware version appears to be incorrect from image {}".format(i, image))
0 commit comments