Skip to content

Commit

Permalink
BQ: use random job ID for system tests. (#4163)
Browse files Browse the repository at this point in the history
  • Loading branch information
tswast committed Oct 12, 2017
1 parent 4e71918 commit a06b84b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions bigquery/tests/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import os
import time
import unittest
import uuid

import six

Expand Down Expand Up @@ -688,7 +689,7 @@ def test_copy_table(self):

def test_job_cancel(self):
DATASET_ID = _make_dataset_id('job_cancel')
JOB_ID = 'fetch_' + DATASET_ID
JOB_ID = 'fetch_' + DATASET_ID + str(uuid.uuid4())
TABLE_NAME = 'test_table'
QUERY = 'SELECT * FROM %s.%s' % (DATASET_ID, TABLE_NAME)

Expand Down Expand Up @@ -924,7 +925,7 @@ def test_query_w_dml(self):

query_job = Config.CLIENT.query(
query_template.format(dataset_name, table_name),
job_id='test_query_w_dml_{}'.format(unique_resource_id()))
job_id='test_query_w_dml_{}'.format(str(uuid.uuid4())))
query_job.result()

self.assertEqual(query_job.num_dml_affected_rows, 1)
Expand All @@ -940,7 +941,7 @@ def test_dbapi_w_dml(self):

Config.CURSOR.execute(
query_template.format(dataset_name, table_name),
job_id='test_dbapi_w_dml_{}'.format(unique_resource_id()))
job_id='test_dbapi_w_dml_{}'.format(str(uuid.uuid4())))
self.assertEqual(Config.CURSOR.rowcount, 1)
self.assertIsNone(Config.CURSOR.fetchone())

Expand Down Expand Up @@ -1112,7 +1113,7 @@ def test_query_w_query_params(self):
example['sql'],
job_config=jconfig,
job_id='test_query_w_query_params{}'.format(
unique_resource_id()))
str(uuid.uuid4())))
rows = list(query_job.result())
self.assertEqual(len(rows), 1)
self.assertEqual(len(rows[0]), 1)
Expand Down

0 comments on commit a06b84b

Please sign in to comment.