8000 Unit tests should not rely on systest environ variables · Issue #194 · googleapis/python-bigquery · GitHub
[go: up one dir, main page]

Skip to content

Unit tests should not rely on systest environ variables #194

@tseaver

Description

@tseaver
$ env | grep GOOGLE && echo YES || echo NO
NO
$ nox -e unit-2.7
nox > Running session unit-2.7
nox > Creating virtual environment (virtualenv) using python2.7 in .nox/unit-2-7
nox > pip install mock pytest google-cloud-testutils pytest-cov freezegun
nox > pip install grpcio
nox > pip install -e .[all,fastparquet]
nox > pip install ipython==5.5
nox > py.test --quiet --cov=google.cloud.bigquery --cov=tests.unit --cov-append --cov-config=.coveragerc --cov-report= --cov-fail-under=0 tests/unit
........................................................................ [  5%]
........................................................................ [ 10%]
........................................................................ [ 15%]
..............F...................F..................................... [ 20%]
........................................................................ [ 25%]
........................................................................ [ 30%]
.......................ss............................................... [ 35%]
........................................................................ [ 40%]
........................................................................ [ 45%]
........................................................................ [ 50%]
........................................................................ [ 55%]
........................................................................ [ 60%]
........................................................................ [ 65%]
.......................................................F................ [ 70%]
........................................................................ [ 75%]
........................................................................ [ 80%]
....................ss.................................................. [ 85%]
........................................................................ [ 90%]
........................................................................ [ 95%]
.....................................................................    [100%]
=================================== FAILURES ===================================
__________ TestClient.test__call_api_applying_custom_retry_on_timeout __________

self = <tests.unit.test_client.TestClient testMethod=test__call_api_applying_custom_retry_on_timeout>

    def test__call_api_applying_custom_retry_on_timeout(self):
        from concurrent.futures import TimeoutError
        from google.cloud.bigquery.retry import DEFAULT_RETRY
    
>       client = self._make_one()

tests/unit/test_client.py:224: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/unit/test_client.py:108: in _make_one
    return self._get_target_class()(*args, **kw)
google/cloud/bigquery/client.py:179: in __init__
    project=project, credentials=credentials, _http=_http
.nox/unit-2-7/lib/python2.7/site-packages/google/cloud/client.py:226: in __init__
    _ClientProjectMixin.__init__(self, project=project)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <google.cloud.bigquery.client.Client object at 0x7f3c1826b590>
project = None

    def __init__(self, project=None):
        project = self._determine_default(project)
        if project is None:
            raise EnvironmentError(
>               "Project was not passed and could not be "
                "determined from the environment."
            )
E           EnvironmentError: Project was not passed and could not be determined from the environment.

.nox/unit-2-7/lib/python2.7/site-packages/google/cloud/client.py:181: EnvironmentError
------------------------------ Captured log call -------------------------------
WARNING  google.auth._default:_default.py:334 No project ID could be determined. Consider running `gcloud config set project` or setting the GOOGLE_CLOUD_PROJECT environment variable
__________ TestClient.test_create_bqstorage_client_missing_dependency __________

self = <tests.unit.test_client.TestClient testMethod=test_create_bqstorage_client_missing_dependency>

    def test_create_bqstorage_client_missing_dependency(self):
>       client = self._make_one()

tests/unit/test_client.py:677: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/unit/test_client.py:108: in _make_one
    return self._get_target_class()(*args, **kw)
google/cloud/bigquery/client.py:179: in __init__
    project=project, credentials=credentials, _http=_http
.nox/unit-2-7/lib/python2.7/site-packages/google/cloud/client.py:226: in __init__
    _ClientProjectMixin.__init__(self, project=project)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <google.cloud.bigquery.client.Client object at 0x7f3c18278c50>
project = None

    def __init__(self, project=None):
        project = self._determine_default(project)
        if project is None:
            raise EnvironmentError(
>               "Project was not passed and could not be "
                "determined from the environment."
            )
E           EnvironmentError: Project was not passed and could not be determined from the environment.

.nox/unit-2-7/lib/python2.7/site-packages/google/cloud/client.py:181: EnvironmentError
------------------------------ Captured log call -------------------------------
WARNING  google.auth._default:_default.py:334 No project ID could be determined. Consider running `gcloud config set project` or setting the GOOGLE_CLOUD_PROJECT environment variable
_____________________ test_bigquery_magic_w_missing_query ______________________

    def test_bigquery_magic_w_missing_query():
        ip = IPython.get_ipython()
        ip.extension_manager.load_extension("google.cloud.bigquery")
        magics.context._project = None
    
        cell_body = "   \n    \n   \t\t  \n  "
    
        with io.capture_output() as captured_io:
>           ip.run_cell_magic("bigquery", "df", cell_body)

tests/unit/test_magics.py:778: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
.nox/unit-2-7/lib/python2.7/site-packages/IPython/core/interactiveshell.py:2117: in run_cell_magic
    result = fn(magic_arg_s, cell)
google/cloud/bigquery/magics.py:503: in _cell_magic
    client_info=client_info.ClientInfo(user_agent=IPYTHON_USER_AGENT),
google/cloud/bigquery/client.py:179: in __init__
    project=project, credentials=credentials, _http=_http
.nox/unit-2-7/lib/python2.7/site-packages/google/cloud/client.py:226: in __init__
    _ClientProjectMixin.__init__(self, project=project)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <google.cloud.bigquery.client.Client object at 0x7f3c17f97c90>
project = None

    def __init__(self, project=None):
        project = self._determine_default(project)
        if project is None:
            raise EnvironmentError(
>               "Project was not passed and could not be "
                "determined from the environment."
            )
E           EnvironmentError: Project was not passed and could not be determined from the environment.

.nox/unit-2-7/lib/python2.7/site-packages/google/cloud/client.py:181: EnvironmentError
55E8

Metadata

Metadata

Assignees

Labels

api: bigqueryIssues related to the googleapis/python-bigquery API.testingtype: processA process-related concern. May include testing, release, or the like.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0