Skip to content

Commit 992ca0c

Browse files
committed
Chore: improve test stability and address some warnings
1 parent a3e7bda commit 992ca0c

File tree

7 files changed

+18
-9
lines changed

7 files changed

+18
-9
lines changed

pyproject.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,11 @@ markers = [
265265
"snowflake: test for Snowflake",
266266
"spark: test for Spark",
267267
"trino: test for Trino (all connectors)",
268-
"risingwave: test for Risingwave"
268+
"risingwave: test for Risingwave",
269+
270+
# Other
271+
"set_default_connection",
272+
"registry_isolation"
269273
]
270274
addopts = "-n 0 --dist=loadgroup"
271275
asyncio_default_fixture_loop_scope = "session"

sqlmesh/core/test/context.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ class TestExecutionContext(ExecutionContext):
1818
models: All upstream models to use for expansion and mapping of physical locations.
1919
"""
2020

21+
__test__ = False # prevent pytest trying to collect this as a test class
22+
2123
def __init__(
2224
self,
2325
engine_adapter: EngineAdapter,

sqlmesh/dbt/test.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ class TestConfig(GeneralConfig):
6161
error_if: Conditional expression (default "!=0") to detect if error condition met (Not supported).
6262
"""
6363

64+
__test__ = (
65+
False # prevent pytest trying to collect this as a test class when it's imported in a test
66+
)
67+
6468
# SQLMesh fields
6569
path: Path = Path()
6670
name: str

tests/conftest.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -222,10 +222,6 @@ def pytest_runtest_makereport(item: pytest.Item, call: pytest.CallInfo):
222222
# note: the hook always has to yield
223223
outcome = yield
224224

225-
# we only care about tests that used the tmp_path fixture
226-
if "tmp_path" not in getattr(item, "fixturenames", []):
227-
return
228-
229225
result: pytest.TestReport = outcome.get_result()
230226

231227
if result.when != "teardown":

tests/dbt/test_integration.py

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

2828

2929
class TestType(str, Enum):
30+
__test__ = False # prevent pytest trying to collect this as a test class
31+
3032
DBT_RUNTIME = "dbt_runtime"
3133
DBT_ADAPTER = "dbt_adapter"
3234
SQLMESH = "sqlmesh"
@@ -53,6 +55,8 @@ def is_sqlmesh_runtime(self) -> bool:
5355

5456

5557
class TestStrategy(str, Enum):
58+
__test__ = False # prevent pytest trying to collect this as a test class
59+
5660
CHECK = "check"
5761
TIMESTAMP = "timestamp"
5862

tests/engines/spark/test_db_api.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@
44
from sqlmesh.engines.spark.db_api import errors
55
from sqlmesh.engines.spark.db_api import spark_session as spark_session_db
66

7-
pytestmark = [
8-
pytest.mark.slow,
9-
pytest.mark.spark_pyspark,
10-
]
7+
pytestmark = [pytest.mark.slow, pytest.mark.spark]
118

129

1310
def test_spark_session_cursor(spark_session: SparkSession):

tests/integrations/github/cicd/test_github_commands.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
from unittest import TestCase, mock
66
from unittest.result import TestResult
77

8+
TestResult.__test__ = False # prevent pytest trying to collect this as a test class
9+
810
import pytest
911
from pytest_mock.plugin import MockerFixture
1012

0 commit comments

Comments
 (0)