Skip to content

SnowparkOperator: Add Session Cleanup Test Coverage#68775

Draft
SameerMesiah97 wants to merge 1 commit into
apache:mainfrom
SameerMesiah97:SnowparkOperator-Add-Session-Cleanup-Test
Draft

SnowparkOperator: Add Session Cleanup Test Coverage#68775
SameerMesiah97 wants to merge 1 commit into
apache:mainfrom
SameerMesiah97:SnowparkOperator-Add-Session-Cleanup-Test

Conversation

@SameerMesiah97

Copy link
Copy Markdown
Contributor

Description

This change adds test coverage verifying that SnowparkOperator closes the Snowpark session when the user callable raises an exception.

The new test exercises the operator's exception path and validates that session cleanup still occurs when execution fails.

Rationale

SnowparkOperator relies on a finally block to guarantee session cleanup. Explicit coverage of this behavior helps protect against regressions that could leave Snowpark sessions open when user code raises an exception.

Notes

While adding the new test, the Snowpark test suite was updated to use dag_maker.run_ti() instead of the removed TaskInstance.run() API.

The Snowpark operator, decorator and util test modules were also updated to use:

pytest.importorskip("snowflake.snowpark")

which matches the importable Snowpark module used by the tests. Without this change, the entire test module was being skipped when run locally.

Backwards Compatibility

This change only affects test code and does not modify production behavior or public APIs.

session when the user callable raises an exception.

As part of enabling the new coverage, migrate the Snowpark tests
away from the removed TaskInstance.run() API and update Snowpark
test dependency detection to use the importable Snowpark module.
@boring-cyborg boring-cyborg Bot added area:providers provider:snowflake Issues related to Snowflake provider labels Jun 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:providers provider:snowflake Issues related to Snowflake provider

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant