fix(cli): make test imports lazy so secrets command works without [dev] extra#900
Conversation
…v] extra Co-Authored-By: AJ Steers <[email protected]>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
There was a problem hiding this comment.
Pull request overview
Makes the CLI resilient when optional dev-only test dependencies (e.g., pytest) are not installed by deferring the test-suite import until tests are actually executed.
Changes:
- Removes the module-level import of
create_connector_test_suiteto prevent eager import chains on CLI startup. - Reintroduces the import inside
run_connector_tests()after the existingpytestpresence guard.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
👋 Greetings, Airbyte Team Member!Here are some helpful tips and reminders for your convenience. 💡 Show Tips and TricksTesting This CDK VersionYou can test this version of the CDK using the following: # Run the CLI from this branch:
uvx 'git+https://github.com/airbytehq/airbyte-python-cdk.git@devin/1770399442-secrets-without-dev#egg=airbyte-python-cdk[dev]' --help
# Update a connector to use the CDK from this branch ref:
cd airbyte-integrations/connectors/source-example
poe use-cdk-branch devin/1770399442-secrets-without-devPR Slash CommandsAirbyte Maintainers can execute the following slash commands on your PR:
|
Co-Authored-By: AJ Steers <[email protected]>
📝 WalkthroughWalkthroughThe change introduces lazy loading by moving the Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Co-Authored-By: AJ Steers <[email protected]>
Summary
Moves the
create_connector_test_suiteimport in_connector.pyfrom module-level to insiderun_connector_tests(), making it lazy. This fixesuvx airbyte-cdk secrets list ...(and all other CLI commands) failing withModuleNotFoundError: No module named 'pytest'when the[dev]extra is not installed.Root cause:
__init__.pyeagerly imports_connector.py, which eagerly importscreate_connector_test_suitefromtest.standard_tests.util, which transitively importsdocker_base.py, which does a hardimport pytest. This breaks the entire CLI—not justconnector test—when pytest isn't installed.The import is placed after the existing
pytest is Noneguard, so users still get a clean error if they runconnector testwithout pytest.Review & Testing Checklist for Human
uvx airbyte-cdk secrets list <connector>works without[dev](can test locally:pip install airbyte-cdkin a clean venv, then runairbyte-cdk secrets list source-postgres)airbyte-cdk connector teststill works when pytest IS installed (e.g. in a dev environment with[dev]extra)Notes
Summary by CodeRabbit