chore: Fix two types of warnings in unit tests by chalmerlowe · Pull Request #2183 · googleapis/python-bigquery · GitHub | Latest TMZ Celebrity News & Gossip | Watch TMZ Live
Skip to content

chore: Fix two types of warnings in unit tests #2183

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
May 14, 2025
Merged

Conversation

chalmerlowe
Copy link
Collaborator

@chalmerlowe chalmerlowe commented May 14, 2025

This commit reduces the number of times two warnings appear when running unit tests:

  1. PytestRemovedIn9Warning in tests/unit/test_opentelemetry_tracing.py: Removed a @pytest.mark.skipif decorator from a fixture. The skip condition is already present on the test methods that use the fixture.

Example warning:

/tmpfs/src/github/python-bigquery/tests/unit/test_opentelemetry_tracing.py:45:
  PytestRemovedIn9Warning: Marks applied to fixtures have no effect
  See docs: https://docs.pytest.org/en/stable/deprecations.html#applying-a-mark-to-a-fixture-function
  @pytest.mark.skipif(opentelemetry is None, reason="Require `opentelemetry`")
  1. FutureWarning in tests/unit/test_client.py: Updated calls to client.query() to include job_retry=None when job_id is also specified. This is to avoid ambiguity as BigQuery cannot retry a failed job with the exact same ID.

Example warning:

tests/unit/test_client.py::TestClient::test_query_preserving_explicit_default_job_config
  /tmpfs/src/github/python-bigquery/tests/unit/test_client.py:4951:
  FutureWarning: job_retry must be explicitly set to None if job_id is set.
  BigQuery cannot retry a failed job by using the exact
  same ID. Setting job_id without explicitly disabling
  job_retry will raise an error in the future. To avoid this
  warning, either use job_id_prefix instead (preferred) or
  set job_retry=None.
    client.query(query, job_id=job_id, location=self.LOCATION, job_config=None)

This commit addresses two warnings that appear when running unit tests:

1.  `PytestRemovedIn9Warning` in `tests/unit/test_opentelemetry_tracing.py`:
    Removed a `@pytest.mark.skipif` decorator from a fixture. The skip condition
    is already present on the test methods using the fixture.

2.  `FutureWarning` in `tests/unit/test_client.py`:
    Updated calls to `client.query()` to include `job_retry=None` when `job_id`
    is also specified. This is to avoid ambiguity as BigQuery cannot retry a
    failed job with the exact same ID.
@chalmerlowe chalmerlowe requested review from a team as code owners May 14, 2025 13:55
@chalmerlowe chalmerlowe requested a review from mrfaizal May 14, 2025 13:55
@product-auto-label product-auto-label bot added the size: s Pull request size is small. label May 14, 2025
@product-auto-label product-auto-label bot added the api: bigquery Issues related to the googleapis/python-bigquery API. label May 14, 2025
@chalmerlowe chalmerlowe removed the request for review from mrfaizal May 14, 2025 13:55
@product-auto-label product-auto-label bot added size: m Pull request size is medium. and removed size: s Pull request size is small. labels May 14, 2025
@chalmerlowe chalmerlowe merged commit 2140a51 into main May 14, 2025
18 checks passed
@chalmerlowe chalmerlowe deleted the fix-pytest-warnings branch May 14, 2025 17:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigquery Issues related to the googleapis/python-bigquery API. size: m Pull request size is medium.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants

TMZ Celebrity News – Breaking Stories, Videos & Gossip

Looking for the latest TMZ celebrity news? You've come to the right place. From shocking Hollywood scandals to exclusive videos, TMZ delivers it all in real time.

Whether it’s a red carpet slip-up, a viral paparazzi moment, or a legal drama involving your favorite stars, TMZ news is always first to break the story. Stay in the loop with daily updates, insider tips, and jaw-dropping photos.

🎥 Watch TMZ Live

TMZ Live brings you daily celebrity news and interviews straight from the TMZ newsroom. Don’t miss a beat—watch now and see what’s trending in Hollywood.