Skip to content

Commit c4de263

Browse files
feat: Add pytest warnings-as-errors configuration similar to PyAirbyte
- Add warnings-as-errors configuration to pytest.ini following PyAirbyte pattern - Include detailed inline comments explaining each warning type and locations - Fix jsonschema import deprecation in transform.py to use protocols import - Ignore specific acceptable warnings: ExperimentalClassWarning, IncrementalMixin deprecation, jsonschema import deprecation, unknown pytest markers - Successfully tested with pytest --collect-only (3750 tests collected) Co-Authored-By: AJ Steers <[email protected]>
1 parent 1b42145 commit c4de263

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

airbyte_cdk/sources/utils/transform.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919

2020
try:
2121
from jsonschema.validators import Validator
22-
except:
23-
from jsonschema import Validator
22+
except ImportError:
23+
from jsonschema.protocols import Validator
2424

2525

2626
MAX_NESTING_DEPTH = 3

pytest.ini

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,25 @@ log_cli_format = %(asctime)s [%(levelname)8s] %(message)s (%(filename)s:%(lineno
55
log_cli_date_format=%Y-%m-%d %H:%M:%S
66
addopts = --junit-xml=build/test-results/pytest-results.xml
77
filterwarnings =
8-
ignore::airbyte_cdk.sources.source.ExperimentalClassWarning
8+
# Treat python warnings as errors in pytest (following PyAirbyte pattern)
9+
error
10+
# Ignore these specific warnings that are expected/acceptable:
11+
12+
# CDK experimental features - already in use, safe to ignore
13+
# Occurs in: airbyte_cdk/sources/declarative/resolvers/config_components_resolver.py:46
14+
ignore:This class is experimental. Use at your own risk.
15+
16+
# IncrementalMixin deprecation warnings - deprecated as of CDK v0.87.0 in favor of CheckpointMixin
17+
# Occurs in: airbyte_cdk/sources/file_based/stream/default_file_based_stream.py:43
18+
# Occurs in: unit_tests/sources/mock_server_tests/mock_source_fixture.py:65
19+
ignore:Deprecated as of CDK version 0.87.0. Deprecated in favor of the `CheckpointMixin`:DeprecationWarning
20+
21+
# jsonschema import deprecation - Validator should be imported from jsonschema.protocols instead
22+
# Occurs in: airbyte_cdk/sources/utils/transform.py:23
23+
ignore:Importing Validator directly from the jsonschema package is deprecated:DeprecationWarning:airbyte_cdk.sources.utils.transform
24+
25+
# Unknown pytest markers - markers used in tests but not declared in pytest.ini
26+
ignore::pytest.PytestUnknownMarkWarning
927
markers =
1028
slow: mark tests as slow
1129
asyncio: mark test as asyncio

0 commit comments

Comments
 (0)