Skip to content

Add Python client integration test suite#46

Merged
ohaibbq merged 5 commits intocandidate/rb20251028from
dan/python-integration-test
Nov 19, 2025
Merged

Add Python client integration test suite#46
ohaibbq merged 5 commits intocandidate/rb20251028from
dan/python-integration-test

Conversation

@ohaibbq
Copy link
Copy Markdown

@ohaibbq ohaibbq commented Nov 18, 2025

This ports all of the existing emulator-specific tests from Recidiviz/pulse-data into this repo. I've also added a new integration test for #45

uv is very cool and very fast

cc @simi @pgcamus failing test cases can now be submitted with Python code samples

@pgcamus
Copy link
Copy Markdown

pgcamus commented Nov 18, 2025

Would you consider using Testcontainers (via testcontainers-python) for testing instead? I'm not sure what all bells and whistles your existing framework offers, but using something "standard" here would be nice.

We use testcontainers for our Python test cases targeting the emulator and could very likely contribute most (all?) of our helpers, allowing use of a @test_bigquery_context decorator idiom like the following.

import unittest

from google.cloud.bigquery import Client
from some_new_module_maybe import test_bigquery_context

class MyTestCase(unittest.TestCase):
    @test_bigquery_context
    def test_foo(self, ctx: tuple[Client, str]) -> None:
       client, project = ctx
       client.query_and_wait("SELECT TRUE")

This would also be useful outside of the emulator's internal tests to people wanting to write unit tests against the emulator.

@ohaibbq
Copy link
Copy Markdown
Author

ohaibbq commented Nov 18, 2025

Not tied to this implementation at all! There's nothing particularly useful in this version of the BigQueryEmulatorControl class. The only nicety in our codebase is a direct integration of our Python classes that represent BigQuery tables and the emulator's --data-from-json startup option.

The testcontainers approach is a lot better! #47

switch to `testcontainers` for the integration test suite
@ohaibbq ohaibbq merged commit 8ec6f05 into candidate/rb20251028 Nov 19, 2025
4 checks passed
@ohaibbq ohaibbq deleted the dan/python-integration-test branch November 19, 2025 05:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants