| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
…n works without azure
There was a problem hiding this comment.
The change is a small, test-only guard that prevents collection-time failures without altering production behavior.
This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.
Pull request overviewThis PR hardens the tests/test_008_auth.py module collection path by making the azure-core dependency optional at import time, preventing pytest from aborting in minimal dependency environments (no azure packages installed) while preserving existing behavior when azure-core is available.
Changes:
| File | Description |
|---|---|
| tests/test_008_auth.py | Avoids module import failure when azure-core is absent; conditionally skips TokenCredential-dependent tests. |
We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.
Sorry, something went wrong.
📊 Code Coverage Report
Diff CoverageDiff: main...HEAD, staged and unstaged changesNo lines with coverage information in this diff. 📋 Files Needing Attention📉 Files with overall lowest coverage (click to expand)mssql_python.pybind.logger_bridge.cpp: 59.2%
mssql_python.pybind.ddbc_bindings.h: 59.9%
mssql_python.pybind.logger_bridge.hpp: 70.8%
mssql_python.pybind.ddbc_bindings.cpp: 76.3%
mssql_python.__init__.py: 77.6%
mssql_python.row.py: 77.6%
mssql_python.ddbc_bindings.py: 79.6%
mssql_python.pybind.connection.connection.cpp: 83.7%
mssql_python.logging.py: 85.5%
mssql_python.connection.py: 85.7%🔗 Quick Links
|
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
AB#46836
Summary
tests/test_008_auth.py added a top-level from azure.core.credentials import TokenCredential (introduced with the token_provider work in #603). That import runs at module-collection time — before the autouse setup_azure_identity fixture injects its mock azure.* modules into sys.modules — so in build/validation stages that install a minimal dependency set (no azure-identity/azure-core), pytest aborts the whole module with:
ModuleNotFoundError: No module named 'azure' tests/test_008_auth.py:32: in <module> from azure.core.credentials import TokenCredentialThis wraps only that one top-level import in a try/except ImportError guard (falling back to TokenCredential = None) so the module collects even when azure-core is absent. The two tests in TestTokenProviderProtocol that genuinely need the real runtime_checkable Protocol are marked @pytest.mark.skipif(TokenCredential is None, ...); the third scope-constant test does not use TokenCredential and continues to run.
All other azure.* imports in this file are function-local and already resolve to the fixture's sys.modules mocks, so no other changes are needed. When azure-core is installed (the normal path), behavior is unchanged and both protocol tests run.
No production code is touched — test-only hardening.