Kaustav Ghosh
09/24/2024, 6:50 PMsource.py
using the python cdk. Also, tell me how to validate it, run it and get the api result schema from it.user
09/24/2024, 6:51 PMKaustav Ghosh
09/24/2024, 6:55 PMuser
09/24/2024, 6:55 PMuser
09/24/2024, 6:55 PMKaustav Ghosh
09/24/2024, 7:10 PMuser
09/24/2024, 7:10 PMuser
09/24/2024, 7:11 PMpytest
to run unit and integration tests. Navigate to the connector directory and run the following command: bash poetry run pytest
(Source: [Testing Connectors - Python Connectors](https://docs.airbyte.com/connector-development/testing-connectors/#connector-specific-tests)) Java Connectors: For Java connectors, you can use gradle
to run tests. Here are the commands for running unit tests and integration tests respectively: bash # Unit tests ./gradlew :airbyte-integrations:connectors:source-postgres:test # Integration tests ./gradlew :airbyte-integrations:connectors:source-postgres:integrationTestJava
(Source: [Testing Connectors - Java Connectors](https://docs.airbyte.com/connector-development/testing-connectors/#connector-specific-tests)) Acceptance Tests: To run acceptance tests, you need to provide connector configuration as a config.json
file in a .secrets
folder in the connector code directory. Here's how you can run acceptance tests: bash # From the root of the airbyte repo cd airbyte-integrations/bases/connector-acceptance-test/ poetry install poetry run pytest -p connector_acceptance_test.plugin --acceptance-test-config=../../connectors/<your-connector> --pdb
(Source: [Acceptance Tests Reference](https://docs.airbyte.com/connector-development/testing-connectors/connector-acceptance-tests-reference#option-2-debugging-run-against-the-acceptance-tests-on-your-branch)) Please replace <your-connector>
with the name of your connector. Remember to install the necessary dependencies before running the tests. For Python, you can use poetry install
and for Java, you can use ./gradlew clean build
.Kaustav Ghosh
09/24/2024, 7:12 PMuser
09/24/2024, 7:12 PMuser
09/24/2024, 7:12 PMModuleNotFoundError: No module named 'airbyte_cdk'
typically occurs when the airbyte_cdk
module is not installed in your Python environment. You can install it using pip: bash pip install airbyte-cdk
If you're using a virtual environment (which is a good practice), make sure you've activated it before running the install command. In one of the forum posts, a user was able to resolve a similar issue by running their script with python3
instead of `python`: bash python3 main.py spec
(Source: [Forum Post: No module named 'airbyte_cdk'](https://discuss.airbyte.io/t/2949)) Also, ensure that you're using a compatible Python version. Some users have reported issues with certain versions of Python, and updating their Python version resolved the issue. (Source: [Forum Post: ERROR: Could not find a version that satisfies the requirement airbyte-cdk~=0.1.56](https://discuss.airbyte.io/t/1397))