| description | Python ingestion — pytest style, connector-specific-file rule, model_str(), formatting |
|---|---|
| paths | ingestion/src/**/*.py |
Applies to ingestion/src/**/*.py. For building/reviewing a connector, load the connector-standards
skill and use connector-building / connector-review. Compliant reference:
ingestion/src/metadata/ingestion/source/database/redshift/connection.py.
- Use pytest, not unittest — plain
assertstatements, pytest fixtures for setup (notsetUp/tearDown). Useunittest.mock(MagicMock, patch) for mocking. Test classes do not inheritTestCase; use plain classes prefixedTest.assert x == y(notself.assertEqual),assert x is None(notassertIsNone),assert "text" in string(notassertIn).
- Keep connector-specific logic in connector-specific files, not in generic/shared files like
builders.py. E.g. Redshift IAM auth belongs iningestion/src/metadata/ingestion/source/database/redshift/connection.py, not iningestion/src/metadata/ingestion/connections/builders.py. This keeps generic utilities from accreting connector edge cases. - Use
model_str()for Pydantic RootModel → string — schema types likeColumnName,EntityName,FullyQualifiedEntityName,UUIDareRootModel[str]subclasses wherestr()yields"root='value'", not the raw value. Usemodel_str()frommetadata.ingestion.ometa.utilsinstead of manualhasattr(x, "root")/str(x.root).
make py_format # ruff lint-fix + format (this is ruff, not black/isort/pycln)
make py_format_check # verify lint + format (matches CI)
make static-checks # basedpyright type checking
make unit_ingestion_dev_env # unit tests