scott-griffiths / bitstring

A Python module to help you manage your bits
https://bitstring.readthedocs.io/en/stable/index.html
MIT License
401 stars 67 forks source link

4.1.2: test_plugin.py problems #301

Closed 0-wiz-0 closed 8 months ago

0-wiz-0 commented 8 months ago

When running the self tests of the pypi 4.1.2 source wheel using pytest on Python 3.11.6/NetBSD, I see:

/usr/pkg/lib/python3.11/site-packages/_pytest/python.py:617: in _importtestmodule
    mod = import_path(self.path, mode=importmode, root=self.config.rootpath)
/usr/pkg/lib/python3.11/site-packages/_pytest/pathlib.py:567: in import_path
    importlib.import_module(module_name)
/usr/pkg/lib/python3.11/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1204: in _gcd_import
    ???
<frozen importlib._bootstrap>:1176: in _find_and_load
    ???
<frozen importlib._bootstrap>:1147: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:690: in _load_unlocked
    ???
/usr/pkg/lib/python3.11/site-packages/_pytest/assertion/rewrite.py:177: in exec_module
    source_stat, co = _rewrite_test(fn, self.config)
/usr/pkg/lib/python3.11/site-packages/_pytest/assertion/rewrite.py:359: in _rewrite_test
    tree = ast.parse(source, filename=strfn)
/usr/pkg/lib/python3.11/ast.py:50: in parse
    return compile(source, filename, mode, flags,
E     File "/scratch/devel/py-bitstring/work/bitstring-4.1.2/bitstring/plugin_test.py", line 8
E       reverse_int = Dtype(name='uintr', getter=getuintr, setter=setuintr)
E       ^^^^^^^^^^^
E   IndentationError: expected an indented block after function definition on line 6

If I add a "pass" in line 6, I get this instead:

ImportError while importing test module '/scratch/devel/py-bitstring/work/bitstring-4.1.2/bitstring/plugin_test.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/pkg/lib/python3.11/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
bitstring/plugin_test.py:2: in <module>
    from bitstring import Dtype
E   ImportError: cannot import name 'Dtype' from 'bitstring' (/scratch/devel/py-bitstring/work/bitstring-4.1.2/bitstring/__init__.py)

When I remove this test file, the other tests succeed without further problems.

scott-griffiths commented 8 months ago

Hi, yes that file got accidentally included in the source wheel - see bug #293.

Thanks for the report - I think this is covered by the earlier bug so I'll close as a duplicate, but I should do a release just to fix this issue as nothing else has turned up recently.