Skip to content
Merged
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
52 changes: 39 additions & 13 deletions tests/unit/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -4719,7 +4719,7 @@ def test_query_w_api_method_query_and_job_id_fails(self):
client._connection = make_connection({})

with self.assertRaises(TypeError) as exc:
client.query(query, job_id="abcd", api_method="QUERY")
client.query(query, job_id="abcd", api_method="QUERY", job_retry=None)
self.assertIn(
"`job_id` was provided, but the 'QUERY' `api_method` was requested",
exc.exception.args[0],
Expand Down Expand Up @@ -4774,7 +4774,11 @@ def test_query_w_explicit_project(self):
conn = client._connection = make_connection(resource)

client.query(
query, job_id=job_id, project="other-project", location=self.LOCATION
query,
job_id=job_id,
project="other-project",
location=self.LOCATION,
job_retry=None,
)

# Check that query actually starts the job.
Expand Down Expand Up @@ -4833,7 +4837,11 @@ def test_query_w_explicit_job_config(self):
original_config_copy = copy.deepcopy(job_config)

client.query(
query, job_id=job_id, location=self.LOCATION, job_config=job_config
query,
job_id=job_id,
location=self.LOCATION,
job_config=job_config,
job_retry=None,
)

# Check that query actually starts the job.
Expand Down Expand Up @@ -4884,7 +4892,11 @@ def test_query_preserving_explicit_job_config(self):
original_config_copy = copy.deepcopy(job_config)

client.query(
query, job_id=job_id, location=self.LOCATION, job_config=job_config
query,
job_id=job_id,
location=self.LOCATION,
job_config=job_config,
job_retry=None,
)

# Check that query actually starts the job.
Expand Down Expand Up @@ -4940,7 +4952,13 @@ def test_query_preserving_explicit_default_job_config(self):
)
conn = client._connection = make_connection(resource)

client.query(query, job_id=job_id, location=self.LOCATION, job_config=None)
client.query(
query,
job_id=job_id,
location=self.LOCATION,
job_config=None,
job_retry=None,
)

# Check that query actually starts the job.
conn.api_request.assert_called_once_with(
Expand Down Expand Up @@ -4978,7 +4996,11 @@ def test_query_w_invalid_job_config(self):

with self.assertRaises(TypeError) as exc:
client.query(
query, job_id=job_id, location=self.LOCATION, job_config=job_config
query,
job_id=job_id,
location=self.LOCATION,
job_config=job_config,
job_retry=None,
)
self.assertIn("Expected an instance of QueryJobConfig", exc.exception.args[0])

Expand Down Expand Up @@ -5027,7 +5049,11 @@ def test_query_w_explicit_job_config_override(self):
job_config.default_dataset = None

client.query(
query, job_id=job_id, location=self.LOCATION, job_config=job_config
query,
job_id=job_id,
location=self.LOCATION,
job_config=job_config,
job_retry=None,
)

# Check that query actually starts the job.
Expand Down Expand Up @@ -5072,7 +5098,7 @@ def test_query_w_client_default_config_no_incoming(self):
)
conn = client._connection = make_connection(resource)

client.query(query, job_id=job_id, location=self.LOCATION)
client.query(query, job_id=job_id, location=self.LOCATION, job_retry=None)

# Check that query actually starts the job.
conn.api_request.assert_called_once_with(
Expand Down Expand Up @@ -5114,7 +5140,7 @@ def test_query_w_client_location(self):
)
conn = client._connection = make_connection(resource)

client.query(query, job_id=job_id, project="other-project")
client.query(query, job_id=job_id, project="other-project", job_retry=None)

# Check that query actually starts the job.
conn.api_request.assert_called_once_with(
Expand Down Expand Up @@ -5178,7 +5204,7 @@ def test_query_w_udf_resources(self):
config.udf_resources = udf_resources
config.use_legacy_sql = True

job = client.query(QUERY, job_config=config, job_id=JOB)
job = client.query(QUERY, job_config=config, job_id=JOB, job_retry=None)

self.assertIsInstance(job, QueryJob)
self.assertIs(job._client, client)
Expand Down Expand Up @@ -5234,7 +5260,7 @@ def test_query_w_query_parameters(self):
config = QueryJobConfig()
config.query_parameters = query_parameters

job = client.query(QUERY, job_config=config, job_id=JOB)
job = client.query(QUERY, job_config=config, job_id=JOB, job_retry=None)

self.assertIsInstance(job, QueryJob)
self.assertIs(job._client, client)
Expand Down Expand Up @@ -5277,7 +5303,7 @@ def test_query_job_rpc_fail_w_random_error(self):
)
with job_begin_patcher:
with pytest.raises(Unknown, match="Not sure what went wrong."):
client.query("SELECT 1;", job_id="123")
client.query("SELECT 1;", job_id="123", job_retry=None)

def test_query_job_rpc_fail_w_conflict_job_id_given(self):
from google.api_core.exceptions import Conflict
Expand All @@ -5293,7 +5319,7 @@ def test_query_job_rpc_fail_w_conflict_job_id_given(self):
)
with job_begin_patcher:
with pytest.raises(Conflict, match="Job already exists."):
client.query("SELECT 1;", job_id="123")
client.query("SELECT 1;", job_id="123", job_retry=None)

def test_query_job_rpc_fail_w_conflict_random_id_job_fetch_fails(self):
from google.api_core.exceptions import Conflict
Expand Down
1 change: 0 additions & 1 deletion tests/unit/test_opentelemetry_tracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
TEST_SPAN_ATTRIBUTES = {"foo": "baz"}


@pytest.mark.skipif(opentelemetry is None, reason="Require `opentelemetry`")
@pytest.fixture
def setup():
importlib.reload(opentelemetry_tracing)
Expand Down