Skip to content

minor(python): split test_context into multiple files - #2838

Open
milenkovicm wants to merge 1 commit into
apache:mainfrom
milenkovicm:feat_python_split_tests
Open

milenkovicm wants to merge 1 commit into
apache:mainfrom
milenkovicm:feat_python_split_tests

Conversation

@milenkovicm

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

N/A. This only reorganizes tests.

Rationale for this change

python/python/tests/test_context.py had grown to ~1000 lines that covered queries, reads, UDFs, writes and config. That made it hard to find a test or see what an area covers. This PR splits it by topic and changes no test logic.

What changes are included in this PR?

The test bodies moved unchanged. Each existing section of test_context.py became its own file:

File Contents
conftest.py cluster, ctx (native and Python client) and ndjson_file fixtures
_util.py Shared constants (TEST_CSV, EXPECTED_A, ...), xfail markers and helpers (to_table, read_back, write_df, ...)
test_context.py Basic queries, session config, cluster_config deprecation, explain and error handling
test_read.py CSV, Parquet and JSON reads, external tables, in-memory sources, cache()
test_udf.py UDF, UDAF and UDWF tests
test_write.py DataFrame writes, write_table, INSERT INTO, COPY TO
test_session_config.py Now also holds the BallistaConfigExtension and information_schema tests, which sit next to the other config tests

Unused imports were removed with ruff.

The cluster fixture keeps scope="module", so each file now starts its own test cluster. Locally the split files still run in ~20s.

Verification

  • Before and after, pytest --collect-only gives the same count: 249 tests.
  • pytest on the affected files: 229 passed, 20 xfailed. The xfails are the existing strict xfails.
  • ruff check and ruff format are clean.

Are there any user-facing changes?

No. Only tests changed.

@milenkovicm

Copy link
Copy Markdown
Contributor Author

i believe this will wrap up my work on ballista python for now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant