Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .circleci/continue_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -310,10 +310,10 @@ workflows:
- athena
- fabric
- gcp-postgres
filters:
branches:
only:
- main
#filters:
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: revert

# branches:
# only:
# - main
- ui_style
- ui_test
- vscode_test
Expand Down
5 changes: 5 additions & 0 deletions .circleci/install-prerequisites.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,9 @@ echo "Installing OS-level dependencies: $ALL_DEPENDENCIES"

sudo apt-get clean && sudo apt-get -y update && sudo ACCEPT_EULA='Y' apt-get -y install $ALL_DEPENDENCIES

if [ "$ENGINE" == "spark" ]; then
echo "Using Java version for spark:"
java -version
fi

echo "All done"
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ postgres-test: engine-postgres-up
pytest -n auto -m "postgres" --retries 3 --junitxml=test-results/junit-postgres.xml

spark-test: engine-spark-up
pytest -n auto -m "spark" --retries 3 --junitxml=test-results/junit-spark.xml
pytest -n auto -m "spark" --retries 3 --junitxml=test-results/junit-spark.xml && pytest -n auto -m "pyspark" --retries 3 --junitxml=test-results/junit-pyspark.xml

trino-test: engine-trino-up
pytest -n auto -m "trino" --retries 3 --junitxml=test-results/junit-trino.xml
Expand Down
7 changes: 6 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,13 @@ markers = [
"redshift: test for Redshift",
"snowflake: test for Snowflake",
"spark: test for Spark",
"pyspark: test for PySpark that need to run separately from the other spark tests",
"trino: test for Trino (all connectors)",
"risingwave: test for Risingwave"
"risingwave: test for Risingwave",

# Other
"set_default_connection",
"registry_isolation"
]
addopts = "-n 0 --dist=loadgroup"
asyncio_default_fixture_loop_scope = "session"
Expand Down
2 changes: 2 additions & 0 deletions sqlmesh/core/test/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ class TestExecutionContext(ExecutionContext):
models: All upstream models to use for expansion and mapping of physical locations.
"""

__test__ = False # prevent pytest trying to collect this as a test class

def __init__(
self,
engine_adapter: EngineAdapter,
Expand Down
4 changes: 4 additions & 0 deletions sqlmesh/dbt/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ class TestConfig(GeneralConfig):
error_if: Conditional expression (default "!=0") to detect if error condition met (Not supported).
"""

__test__ = (
False # prevent pytest trying to collect this as a test class when it's imported in a test
)

# SQLMesh fields
path: Path = Path()
name: str
Expand Down
24 changes: 8 additions & 16 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,27 +222,19 @@ def pytest_runtest_makereport(item: pytest.Item, call: pytest.CallInfo):
# note: the hook always has to yield
outcome = yield

# we only care about tests that used the tmp_path fixture
if "tmp_path" not in getattr(item, "fixturenames", []):
return

result: pytest.TestReport = outcome.get_result()

if result.when != "teardown":
return
return result

# If we specifically failed with a StashKey error in teardown, mark the test as passed
if result.failed:
exception = call.excinfo
if (
exception
and isinstance(exception.value, KeyError)
and "_pytest.stash.StashKey" in repr(exception)
):
result.outcome = "passed"
item.add_report_section(
"teardown", "stderr", f"Ignored tmp_path teardown error: {exception}"
)
if (exception := call.excinfo) and "_pytest.stash.StashKey" in repr(exception):
call.excinfo = None
result.outcome = "passed"
item.add_report_section(
"teardown", "stderr", f"Ignored tmp_path teardown error: {exception}"
)
return result


def pytest_configure(config: pytest.Config):
Expand Down
4 changes: 4 additions & 0 deletions tests/dbt/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@


class TestType(str, Enum):
__test__ = False # prevent pytest trying to collect this as a test class

DBT_RUNTIME = "dbt_runtime"
DBT_ADAPTER = "dbt_adapter"
SQLMESH = "sqlmesh"
Expand All @@ -53,6 +55,8 @@ def is_sqlmesh_runtime(self) -> bool:


class TestStrategy(str, Enum):
__test__ = False # prevent pytest trying to collect this as a test class

CHECK = "check"
TIMESTAMP = "timestamp"

Expand Down
8 changes: 4 additions & 4 deletions tests/engines/spark/test_db_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
from sqlmesh.engines.spark.db_api import errors
from sqlmesh.engines.spark.db_api import spark_session as spark_session_db

pytestmark = [
pytest.mark.slow,
pytest.mark.spark_pyspark,
]
# note: this is deliberately not marked with 'spark' so that it
# can run separately from the spark integration tests.
# running them at the same time mutates some global state in the SparkSession which breaks these tests
pytestmark = [pytest.mark.slow, pytest.mark.pyspark]


def test_spark_session_cursor(spark_session: SparkSession):
Expand Down
2 changes: 2 additions & 0 deletions tests/integrations/github/cicd/test_github_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
from unittest import TestCase, mock
from unittest.result import TestResult

TestResult.__test__ = False # prevent pytest trying to collect this as a test class

import pytest
from pytest_mock.plugin import MockerFixture

Expand Down