Skip to content

Commit 6698d35

Browse files
committed
address review comments
1 parent c7cbca0 commit 6698d35

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

integration_tests/src/main/python/spark_init_internal.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ def conf_for_env(env_name):
5151
_SPARK_JARS,
5252
_SPARK_JARS_PACKAGES
5353
}
54+
# Initialized in pytest_sessionstart; declared here so pytest_sessionfinish
55+
# does not raise NameError if session startup fails before assignment.
56+
_spark = None
5457

5558
def findspark_init():
5659
import findspark
@@ -312,4 +315,6 @@ def pytest_sessionfinish(session, exitstatus):
312315
_spark.stop()
313316
except Exception as e:
314317
logging.warning(f"Exception while stopping SparkSession: {e}")
318+
finally:
319+
_spark = None
315320

0 commit comments

Comments
 (0)