Skip to content

fix: resolve absolute package imports when pytest runs from repo root - #58

Merged
matyas7dub merged 1 commit into
CESNET:mainfrom
Davihan11:crit_bug/path_resolve
Sep 8, 2026
Merged

matyas7dub merged 1 commit into
CESNET:mainfrom
Davihan11:crit_bug/path_resolve

Conversation

@Davihan11

Copy link
Copy Markdown
Collaborator

Since the traffic-profile relocation (f99e8c3), performance tests import their profiles via absolute package paths (suricata_pytests.assets...). pytest is launched from inside this directory (pytest_start.sh), which puts the directory itself - not its parent - on sys.path, so collection fails with ModuleNotFoundError: No module named 'suricata_pytests'.

Insert the parent directory into sys.path from conftest.py so the package resolves regardless of the invocation directory.

Since the traffic-profile relocation (f99e8c3), performance tests import
their profiles via absolute package paths (suricata_pytests.assets...).
pytest is launched from inside this directory (pytest_start.sh), which
puts the directory itself - not its parent - on sys.path, so collection
fails with ModuleNotFoundError: No module named 'suricata_pytests'.

Insert the parent directory into sys.path from conftest.py so the
package resolves regardless of the invocation directory.
@Davihan11
Davihan11 requested a review from matyas7dub September 8, 2026 07:31
@Davihan11 Davihan11 self-assigned this Sep 8, 2026
@Davihan11 Davihan11 added the bug Something isn't working label Sep 8, 2026

@matyas7dub matyas7dub left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@matyas7dub
matyas7dub merged commit cbb1ef1 into CESNET:main Sep 8, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants