-
Notifications
You must be signed in to change notification settings - Fork 174
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FEAT] consolidate Spark session fixture into conftest.py (#3341)
- Loading branch information
1 parent
ec24c80
commit bdfb8c6
Showing
8 changed files
with
70 additions
and
60 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from __future__ import annotations | ||
|
||
import pytest | ||
from pyspark.sql import SparkSession | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def spark_session(): | ||
""" | ||
Fixture to create and clean up a Spark session. | ||
This fixture is available to all test files and creates a single | ||
Spark session for the entire test suite run. | ||
""" | ||
from daft.daft import connect_start | ||
|
||
# Start Daft Connect server | ||
server = connect_start() | ||
|
||
url = f"sc://localhost:{server.port()}" | ||
|
||
# Initialize Spark Connect session | ||
session = SparkSession.builder.appName("DaftConfigTest").remote(url).getOrCreate() | ||
|
||
yield session | ||
|
||
# Cleanup | ||
server.shutdown() | ||
session.stop() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters