Skip to content

Commit e58dfad

Browse files
committed
[cherry-pick-me][chore]: resolve pytest warnings undeclared marks, and for classes starting with "Test"
1 parent 4a05f46 commit e58dfad

File tree

8 files changed

+21
-0
lines changed

8 files changed

+21
-0
lines changed

airbyte_cdk/connector_builder/connector_builder_handler.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737

3838
@dataclass
3939
class TestLimits:
40+
__test__: bool = False # Prevent pytest from treating this as a test case, despite its name
41+
4042
max_records: int = field(default=DEFAULT_MAXIMUM_RECORDS)
4143
max_pages_per_slice: int = field(default=DEFAULT_MAXIMUM_NUMBER_OF_PAGES_PER_SLICE)
4244
max_slices: int = field(default=DEFAULT_MAXIMUM_NUMBER_OF_SLICES)

airbyte_cdk/connector_builder/test_reader/reader.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ class TestReader:
6666
6767
"""
6868

69+
__test__: bool = False # Prevent pytest from treating this as a test case, despite its name
70+
6971
logger = logging.getLogger("airbyte.connector-builder")
7072

7173
def __init__(

pytest.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,6 @@ log_cli_format = %(asctime)s [%(levelname)8s] %(message)s (%(filename)s:%(lineno
55
log_cli_date_format=%Y-%m-%d %H:%M:%S
66
filterwarnings =
77
ignore::airbyte_cdk.sources.source.ExperimentalClassWarning
8+
markers =
9+
slow: mark tests as slow
10+
asyncio: mark test as asyncio

unit_tests/sources/declarative/decoders/test_composite_decoder.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,8 @@ def test_composite_raw_decoder_csv_parser_values(requests_mock, encoding: str, d
259259

260260

261261
class TestServer(BaseHTTPRequestHandler):
262+
__test__ = False # Prevent pytest from thinking that this is a test class, despite the name
263+
262264
def do_GET(self) -> None:
263265
self.send_response(200)
264266
self.end_headers()

unit_tests/sources/declarative/parsers/testing_components.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ class TestingSomeComponent(DefaultErrorHandler):
2121
A basic test class with various field permutations used to test manifests with custom components
2222
"""
2323

24+
__test__ = False # Prevent pytest from thinking that this is a test class, despite the name
25+
2426
subcomponent_field_with_hint: DpathExtractor = field(
2527
default_factory=lambda: DpathExtractor(field_path=[], config={}, parameters={})
2628
)
@@ -37,5 +39,7 @@ class TestingCustomSubstreamPartitionRouter(SubstreamPartitionRouter):
3739
A test class based on a SubstreamPartitionRouter used for testing manifests that use custom components.
3840
"""
3941

42+
__test__ = False # Prevent pytest from thinking that this is a test class, despite the name
43+
4044
custom_field: str
4145
custom_pagination_strategy: PaginationStrategy

unit_tests/sources/declarative/test_yaml_declarative_source.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@ def test_source_with_missing_reference_fails(self):
133133

134134

135135
class TestFileContent:
136+
__test__ = False # Prevent pytest from thinking that this is a test class, despite the name
137+
136138
def __init__(self, content):
137139
self.file = tempfile.NamedTemporaryFile(mode="w", delete=False)
138140

unit_tests/sources/file_based/scenarios/scenario_builder.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ def build(
4242

4343

4444
class TestScenario(Generic[SourceType]):
45+
__test__ = False # Prevent pytest from thinking that this is a test class, despite the name
46+
4547
def __init__(
4648
self,
4749
name: str,

unit_tests/sources/file_based/test_file_based_stream_reader.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@
6262

6363

6464
class TestStreamReader(AbstractFileBasedStreamReader):
65+
__test__ = False # Prevent pytest from thinking that this is a test class, despite the name
66+
6567
@property
6668
def config(self) -> Optional[AbstractFileBasedSpec]:
6769
return self._config
@@ -100,6 +102,8 @@ def identities_schema(self) -> Dict[str, Any]:
100102

101103

102104
class TestSpec(AbstractFileBasedSpec):
105+
__test__ = False # Prevent pytest from thinking that this is a test class, despite the name
106+
103107
@classmethod
104108
def documentation_url(cls) -> AnyUrl:
105109
return AnyUrl(scheme="https", url="https://docs.airbyte.com/integrations/sources/test") # type: ignore

0 commit comments

Comments
 (0)