greatscottgadgets / python-usb-protocol

python library providing utilities, data structures, constants, parsers, and tools for working with USB data
BSD 3-Clause "New" or "Revised" License
55 stars 32 forks source link

construct.py: 'import construct' imports the own file which breaks the unit test #11

Closed hansfbaier closed 3 years ago

hansfbaier commented 3 years ago
$ python3 construct.py 
construct module path: /devel/HDL/src/python-usb-protocol/usb_protocol/emitters/construct.py
E
======================================================================
ERROR: test_simple_emitter (__main__.ConstructEmitterTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "construct.py", line 81, in test_simple_emitter
    test_struct = construct.Struct(
AttributeError: module 'construct' has no attribute 'Struct'

----------------------------------------------------------------------
Ran 1 test in 0.000s

FAILED (errors=1)

$ mv construct.py my_construct.py

/devel/HDL/src/python-usb-protocol/usb_protocol/emitters on  master! ⌚ 8:26:59
$ python3 my_construct.py 
construct module path: /usr/local/lib/python3.8/dist-packages/construct-2.10.56-py3.8.egg/construct/__init__.py
.
----------------------------------------------------------------------
Ran 1 test in 0.000s

OK