fix: restore tools/__init__.py so tools.* imports work in tests#21
Open
venkatas wants to merge 1 commit intoshuvonsec:mainfrom
Open
fix: restore tools/__init__.py so tools.* imports work in tests#21venkatas wants to merge 1 commit intoshuvonsec:mainfrom
venkatas wants to merge 1 commit intoshuvonsec:mainfrom
Conversation
…scanner collect
tests/test_credential_store.py and tests/test_token_scanner.py both do
``from tools.credential_store import CredentialStore`` (and similar),
which requires tools/ to be an importable Python package. Without
tools/__init__.py, pytest errors out during collection:
ModuleNotFoundError: No module named 'tools.credential_store'
55 passing tests disappear as a result. Adding a trivial package
marker brings them back (total: 191 → 242 passing under
``PYTHONPATH=. pytest tests/``).
Note: tests/test_recon_adapter.py still fails to import — the test
expects an OO ``ReconAdapter`` class, but tools/recon_adapter.py only
exposes functional APIs (``load_recon``, ``normalize_to_nested``).
That is a module/test API drift to resolve in a separate PR; this
change does not touch it.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two test modules currently fail to collect under
pytest tests/:tests/test_credential_store.py→ModuleNotFoundError: No module named 'tools.credential_store'tests/test_token_scanner.py→ same fortools.token_scannerBoth do
from tools.credential_store import CredentialStoreetc., which requirestools/to be an importable Python package. There is notools/__init__.pyin the tree, so pytest bails out during collection and 55 otherwise-passing tests disappear.Adding a trivial
tools/__init__.pyrestores them.Before / after
Net change: 191 → 242 passing tests (+55 recovered, including the 4 from the recent PR #19 auto-detect patch).
Not addressed here
tests/test_recon_adapter.pyalso fails to import, but for a different reason:The test expects an OO
ReconAdapterclass; the module only exposes functional APIs (load_recon,normalize_to_nested,ReconDatadataclass). That's a module/test API drift — worth a separate PR that either adds aReconAdapterwrapper class or rewrites the test against the functional API. I deliberately left it out of this change to keep the diff minimal and reviewable.Test plan
PYTHONPATH=. pytest tests/test_credential_store.py tests/test_token_scanner.py -v— 55 pass, 0 errorPYTHONPATH=. pytest tests/ --ignore tests/test_cicd_scanner.sh --ignore tests/test_recon_adapter.py— 242 pass🤖 Generated with Claude Code