Test failure
fabaff opened this issue · 3 comments
fabaff commented
Report
Lately in nixpkg we see a test failure with Python 3.10 and Python 3.11 due to a SyntaxError
.
============================= test session starts ==============================
platform linux -- Python 3.10.9, pytest-7.2.0, pluggy-1.0.0
rootdir: /build/source, configfile: setup.cfg, testpaths: unit_tests
plugins: bdd-6.1.1
collected 203 items / 18 deselected / 185 selected
unit_tests/test_bit_field_original_value.py .... [ 2%]
[...]
unit_tests/test_helpers_udp_checksum.py ....F... [ 53%]
unit_tests/test_legos.py s.. [ 55%]
[...]
unit_tests/test_target.py .. [100%]
=================================== FAILURES ===================================
______________________________ test_msg_60_bytes _______________________________
fixturefunc = <function msg_1_byte at 0x7ffff51dfbe0>
request = <FixtureRequest for <Function test_msg_60_bytes>>
kwargs = {'context': <unit_tests.conftest.context.<locals>.Context object at 0x7ffff503d750>, 'msg': 'with 60 bytes'}
def call_fixture_func(
fixturefunc: "_FixtureFunc[FixtureValue]", request: FixtureRequest, kwargs
) -> FixtureValue:
if is_generator(fixturefunc):
fixturefunc = cast(
Callable[..., Generator[FixtureValue, None, None]], fixturefunc
)
generator = fixturefunc(**kwargs)
try:
fixture_result = next(generator)
except StopIteration:
raise ValueError(f"{request.fixturename} did not yield a value") from None
finalizer = functools.partial(_teardown_yield_fixture, fixturefunc, generator)
request.addfinalizer(finalizer)
else:
fixturefunc = cast(Callable[..., FixtureValue], fixturefunc)
> fixture_result = fixturefunc(**kwargs)
/nix/store/c5qvrk78x6ak9fmlzz5pmfvnhf0lj2g7-python3.10-pytest-7.2.0/lib/python3.10/site-packages/_pytest/fixtures.py:907:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
unit_tests/test_helpers_udp_checksum.py:24: in msg_1_byte
context.msg = ast.literal_eval(msg)
/nix/store/0pyymzxf7n0fzpaqnvwv92ab72v3jq8d-python3-3.10.9/lib/python3.10/ast.py:64: in literal_eval
node_or_string = parse(node_or_string.lstrip(" \t"), mode='eval')
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
source = 'with 60 bytes', filename = '<unknown>', mode = 'eval'
def parse(source, filename='<unknown>', mode='exec', *,
type_comments=False, feature_version=None):
"""
Parse the source into an AST node.
Equivalent to compile(source, filename, mode, PyCF_ONLY_AST).
Pass type_comments=True to get back type comments where the syntax allows.
"""
flags = PyCF_ONLY_AST
if type_comments:
flags |= PyCF_TYPE_COMMENTS
if isinstance(feature_version, tuple):
major, minor = feature_version # Should be a 2-tuple.
assert major == 3
feature_version = minor
elif feature_version is None:
feature_version = -1
# Else it should be an int giving the minor version for 3.x.
> return compile(source, filename, mode, flags,
_feature_version=feature_version)
E File "<unknown>", line 1
E with 60 bytes
E ^^^^
E SyntaxError: invalid syntax
/nix/store/0pyymzxf7n0fzpaqnvwv92ab72v3jq8d-python3-3.10.9/lib/python3.10/ast.py:50: SyntaxError
=============================== warnings summary ===============================
../../nix/store/fdm6a2cfaxlbgr55xd2yhz1smgcxly71-python3.10-future-0.18.3/lib/python3.10/site-packages/future/standard_library/__init__.py:65
/nix/store/fdm6a2cfaxlbgr55xd2yhz1smgcxly71-python3.10-future-0.18.3/lib/python3.10/site-packages/future/standard_library/__init__.py:65: DeprecationWarning: the imp module is deprecated in favour of importlib and slated for removal in Python 3.12; see the module's documentation for alternative uses
import imp
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
FAILED unit_tests/test_helpers_udp_checksum.py::test_msg_60_bytes - File "<unknown>", line 1
====== 1 failed, 182 passed, 2 skipped, 18 deselected, 1 warning in 1.27s ======
Expected behavior
No response
Actual behavior
No response
Steps to reproduce the problem
boofuzz script
No response
boofuzz version
0.4.1
Python version
3.11
Platform
Linux
Anything else?
It started to fail somewhere around the end of 2022.
Every feedback would be appreciated as I'm not familiar with the code base. Thanks.
SR4ven commented
Hi @fabaff. I think this error was fixed in 6e509e7.
However, we haven't published a new version to PyPi since, so that might be the reason why you're still seeing the error.
Would you mind installing boofuzz from source (https://boofuzz.readthedocs.io/en/stable/user/install.html#from-source) and check if the error persists?
SR4ven commented
Should be fixed in v0.4.2
fabaff commented
Thanks