Skip to content
Open
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
6 changes: 6 additions & 0 deletions .github/workflows/python_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ jobs:
enable-cache: 'true'
cache-suffix: ${{ matrix.PYTHON_VERSION }}

- name: Set up Java
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
with:
distribution: temurin
java-version: '11'

- name: Test the library
run: |
uv run --directory divref --locked poe check-all
20 changes: 20 additions & 0 deletions divref/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
"""Shared pytest fixtures for the divref test suite."""

from collections.abc import Generator

import hail as hl
import pytest


@pytest.fixture(scope="session")
def hail_context() -> Generator[None, None, None]:
"""
Initialize a local Hail context for the test session.

Starts a local Spark/JVM context once per session and stops it on exit.
Tests that use Hail expressions must request this fixture explicitly.
Requires Java 11+ to be available in PATH (provided by pixi or setup-java).
"""
hl.init(quiet=True)
yield
hl.stop()
3 changes: 1 addition & 2 deletions divref/tests/tools/test_create_fasta_and_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ def mock_get_sequence(
return mock_get_sequence


@pytest.mark.skip(reason="Requires a running Hail/Spark JVM context")
def test_get_haplo_sequence_edge_cases() -> None:
def test_get_haplo_sequence_edge_cases(hail_context: None) -> None: # noqa: ARG001
"""Test get_haplo_sequence with SNPs, insertions, and deletions."""
reference = "01234567891"

Expand Down
Loading