Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Potential issues with the test codes: tostring bug when using Python 3.9 #373

Copy link
Copy link
@mcuee

Description

@mcuee
Issue body actions

I understand that the HW based test has been disabled. However, it seems to me that I can still run it and there are a few error messages which may point to the errors of the test codes (probably they are not matching with the latest pyusb codes).

I just built the bmfw from Wander (https://github.com/walac/bmfw) and here is the run log. I am using Python 3.9.5 within a virtual environment under Windows 10 64bit. The two failed cases are kind of expected because my FW built configuration may not match the test code (for example no isochronous endpoint). But the two errors may be a problem.

(py39venv) C:\work\libusb\pyusb\tests [master ≡ +1 ~0 -0 !]> python
Python 3.9.5 (tags/v3.9.5:0a7dcbd, May  3 2021, 17:27:52) [MSC v.1928 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.

(py39venv) C:\work\libusb\pyusb\tests [master ≡ +1 ~0 -0 !]> python .\testall.py
FE.F.........E......
======================================================================
ERROR: runTest (test_control.ControlTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\work\libusb\pyusb\tests\test_control.py", line 56, in runTest
    self.test_getset_descriptor()
  File "C:\work\libusb\pyusb\tests\test_control.py", line 107, in test_getset_descriptor
    self.assertEqual(struct.unpack(dev_fmt, ret.tostring()), dev_descr)
AttributeError: 'array.array' object has no attribute 'tostring'

======================================================================
ERROR: runTest (test_legacy.LegacyTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\work\libusb\pyusb\tests\test_legacy.py", line 63, in runTest
    self.test_get_descriptor()
  File "C:\work\libusb\pyusb\tests\test_legacy.py", line 241, in test_get_descriptor
    self.assertEqual(struct.unpack(dev_fmt, ret.tostring()), dev_descr)
AttributeError: 'array.array' object has no attribute 'tostring'

======================================================================
FAIL: runTest (test_backend.BackendTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\work\libusb\pyusb\tests\test_backend.py", line 64, in runTest
    self.test_iso_write_read()
  File "C:\work\libusb\pyusb\tests\test_backend.py", line 205, in test_iso_write_read
    self.__write_read(
  File "C:\work\libusb\pyusb\tests\test_backend.py", line 275, in __write_read
    self.assertEqual(ret, length, str(ret) + ' != ' + str(length))
AssertionError: 0 != 64 : 0 != 64

======================================================================
FAIL: runTest (test_integration.DeviceTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\work\libusb\pyusb\tests\test_integration.py", line 68, in runTest
    self.test_write_read()
  File "C:\work\libusb\pyusb\tests\test_integration.py", line 165, in test_write_read
    self.assertTrue(
AssertionError: False is not true : array('B', [0, 1, 5, 4, 3, 2, 1, 0, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 0, 1, 5, 4, 3, 2, 1, 0, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) != array('B', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63]), in interface = 2

----------------------------------------------------------------------
Ran 20 tests in 2.694s

FAILED (failures=2, errors=2)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.