Skip to content

Integration test asserts a pyshark AttributeError that the engine preflight now prevents #414

Description

@JarryShaw

tests/integration/test_engine_runtime.py::EngineRuntimeTests::test_pyshark_engine_currently_breaks_on_modern_asyncio
fails on a clean main on Python 3.14.

>           with self.assertRaises(AttributeError):
E           AssertionError: AttributeError not raised

Why

The test was written when asking for engine='pyshark' on 3.14 raised out of
pyshark itself — it builds its event loop with
asyncio.get_event_loop_policy().get_event_loop(), and 3.14 refuses to create
an implicit loop. Asserting the AttributeError was an accurate description of
the behaviour at the time.

PyShark.unsupported_reason() (added in #405) now answers that question before
anything is imported, so Extractor declines the engine, warns, and falls back
to pcapkit's own parser. The exception the test waits for can no longer
happen. Visible in the captured log of the failing run:

WARNING pcapkit.utilities.warnings: engine PyShark is not supported on this
interpreter (pyshark does not support Python 3.14; it builds its event loop with
`asyncio.get_event_loop_policy().get_event_loop()`, which raises RuntimeError
from Python 3.14 when no current event loop exists); using default engine instead

So the failure is the test being stale, not a regression in the library — the new
behaviour is the intended one and is strictly better.

Why it went unnoticed

The test lives in tests/integration/, which the CI selection (make test)
excludes because it needs sample captures that are not tracked in the
repository. Nothing on a push runs it.

Fix

Assert what the preflight now does: an EngineWarning naming the engine and the
interpreter, and a successful extraction through the fallback. The pre-3.14
branch of the test is unaffected and still asserts a real pyshark run.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    testPull requests that add or correct tests (test: subject prefix)

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions