Skip to content

Commit

Permalink
Add complete tests for resumable
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon Wayne Parrott committed Jul 20, 2017
1 parent aa7999f commit cc51bc0
Show file tree
Hide file tree
Showing 4 changed files with 327 additions and 458 deletions.
12 changes: 2 additions & 10 deletions bigquery/google/cloud/bigquery/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"""Define API Datasets."""

import datetime
import json
import os

import httplib2
Expand All @@ -26,7 +25,6 @@
from google.resumable_media.requests import MultipartUpload
from google.resumable_media.requests import ResumableUpload

from google.cloud._helpers import _bytes_to_unicode
from google.cloud._helpers import _datetime_from_microseconds
from google.cloud._helpers import _millis_from_datetime
from google.cloud.exceptions import NotFound
Expand All @@ -50,6 +48,7 @@
_READ_LESS_THAN_SIZE = (
'Size {:d} was specified but the file-like object only had '
'{:d} bytes remaining.')
_DEFAULT_NUM_RETRIES = 6


class Table(object):
Expand Down Expand Up @@ -1004,7 +1003,7 @@ def upload_from_file(self,
source_format,
rewind=False,
size=None,
num_retries=6,
num_retries=_DEFAULT_NUM_RETRIES,
allow_jagged_rows=None,
allow_quoted_newlines=None,
create_disposition=None,
Expand Down Expand Up @@ -1215,13 +1214,6 @@ def _build_schema_resource(fields):
# pylint: enable=unused-argument


def _convert_timestamp(value):
"""Helper for :meth:`Table.insert_data`."""
if isinstance(value, datetime.datetime):
value = _microseconds_from_datetime(value) * 1e-6
return value


def _maybe_rewind(stream, rewind=False):
"""Rewind the stream if desired.
Expand Down
4 changes: 2 additions & 2 deletions bigquery/nox.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ def unit_tests(session, python_version):
# Run py.test against the unit tests.
session.run('py.test', '--quiet',
'--cov=google.cloud.bigquery', '--cov=tests.unit', '--cov-append',
'--cov-config=.coveragerc', '--cov-report=', '--cov-fail-under=97',
'tests/unit',
'--cov-config=.coveragerc', '--cov-report=term-missing', '--cov-fail-under=97',
'tests/unit', *session.posargs
)


Expand Down

0 comments on commit cc51bc0

Please sign in to comment.