Skip to content
This repository was archived by the owner on Sep 2, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all 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
16 changes: 8 additions & 8 deletions dev_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ git+https://github.com/dbt-labs/dbt-core.git#egg=dbt-core&subdirectory=core
git+https://github.com/dbt-labs/dbt-core.git#egg=dbt-tests-adapter&subdirectory=tests/adapter

freezegun==0.3.9
pytest==6.0.2
pytest>=6.0.2
mock>=1.3.0
flake8>=3.5.0
pytz==2017.2
bumpversion==0.5.3
tox==3.2.0
flake8
pytz
bumpversion
tox>=3.2.0
ipdb
pytest-xdist>=2.1.0,<3
flaky>=3.5.3,<4
pytest-xdist
pytest-dotenv
pytest-csv
flaky

# Test requirements
pytest-dbt-adapter==0.6.0
sasl>=0.2.1
thrift_sasl==0.4.1
16 changes: 14 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ def dbt_profile_target(request):
target = apache_spark_target()
elif profile_type == "databricks_http_cluster":
target = databricks_http_cluster_target()
elif profile_type == "spark_session":
target = spark_session_target()
else:
raise ValueError(f"Invalid profile type '{profile_type}'")
return target
Expand Down Expand Up @@ -82,9 +84,19 @@ def databricks_http_cluster_target():
"connect_timeout": 60,
}


def spark_session_target():
return {
"type": "spark",
"host": "localhost",
"method": "session",
}


@pytest.fixture(autouse=True)
def skip_by_profile_type(request):
profile_type = request.config.getoption("--profile")
if request.node.get_closest_marker("skip_profile"):
if request.node.get_closest_marker("skip_profile").args[0] == profile_type:
pytest.skip("skipped on '{profile_type}' profile")
for skip_profile_type in request.node.get_closest_marker("skip_profile").args:
if skip_profile_type == profile_type:
pytest.skip("skipped on '{profile_type}' profile")
10 changes: 5 additions & 5 deletions tests/functional/adapter/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from dbt.tests.adapter.basic.test_snapshot_timestamp import BaseSnapshotTimestamp


@pytest.mark.skip_profile('databricks_sql_endpoint')
@pytest.mark.skip_profile('databricks_sql_endpoint', 'spark_session')
class TestSimpleMaterializationsSpark(BaseSimpleMaterializations):
pass

Expand All @@ -33,12 +33,12 @@ class TestEmptySpark(BaseEmpty):
pass


@pytest.mark.skip_profile('databricks_sql_endpoint')
@pytest.mark.skip_profile('databricks_sql_endpoint', 'spark_session')
class TestEphemeralSpark(BaseEphemeral):
pass


@pytest.mark.skip_profile('databricks_sql_endpoint')
@pytest.mark.skip_profile('databricks_sql_endpoint', 'spark_session')
class TestIncrementalSpark(BaseIncremental):
pass

Expand All @@ -49,7 +49,7 @@ class TestGenericTestsSpark(BaseGenericTests):

# These tests were not enabled in the dbtspec files, so skipping here.
# Error encountered was: Error running query: java.lang.ClassNotFoundException: delta.DefaultSource
@pytest.mark.skip_profile('apache_spark')
@pytest.mark.skip_profile('apache_spark', 'spark_session')
class TestSnapshotCheckColsSpark(BaseSnapshotCheckCols):
@pytest.fixture(scope="class")
def project_config_update(self):
Expand All @@ -65,7 +65,7 @@ def project_config_update(self):

#hese tests were not enabled in the dbtspec files, so skipping here.
# Error encountered was: Error running query: java.lang.ClassNotFoundException: delta.DefaultSource
@pytest.mark.skip_profile('apache_spark')
@pytest.mark.skip_profile('apache_spark', 'spark_session')
class TestSnapshotTimestampSpark(BaseSnapshotTimestamp):
@pytest.fixture(scope="class")
def project_config_update(self):
Expand Down
17 changes: 0 additions & 17 deletions tests/specs/spark-session.dbtspec

This file was deleted.

2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ deps =

[testenv:integration-spark-session]
basepython = python3
commands = /bin/bash -c '{envpython} -m pytest -v tests/specs/spark-session.dbtspec'
commands = /bin/bash -c '{envpython} -m pytest -v --profile spark_session tests/functional/adapter/test_basic.py'
passenv =
DBT_*
PYTEST_*
Expand Down