Skip to content
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

Functional test - Add datastore query tests #281

Merged
merged 5 commits into from
Oct 27, 2014
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Making get_dataset() in regression utils use a global.
  • Loading branch information
dhermes committed Oct 27, 2014
commit 4af407acb5d8b5f59af735d02aa73e9eb69d90e1
16 changes: 8 additions & 8 deletions regression/regression_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
DATASET_ID = os.getenv('GCLOUD_TESTS_DATASET_ID')
CLIENT_EMAIL = os.getenv('GCLOUD_TESTS_CLIENT_EMAIL')
KEY_FILENAME = os.getenv('GCLOUD_TESTS_KEY_FILE')
DATASETS = {}

ENVIRON_ERROR_MSG = """\
To run the regression tests, you need to set some environment variables.
Expand All @@ -28,11 +29,10 @@ def get_environ():


def get_dataset():
if get_dataset.cached_result is None:
environ = get_environ()
# Cache value on the function.
get_dataset.cached_result = datastore.get_dataset(
environ['dataset_id'], environ['client_email'],
environ['key_filename'])
return get_dataset.cached_result
get_dataset.cached_result = None
environ = get_environ()
get_dataset_args = (environ['dataset_id'], environ['client_email'],
environ['key_filename'])
if get_dataset_args not in DATASETS:
# Cache return value for the environment.
DATASETS[get_dataset_args] = datastore.get_dataset(*get_dataset_args)
return DATASETS[get_dataset_args]
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ deps =
basepython =
python2.7
commands =
rm -fr docs/_build
python -c "import shutil; shutil.rmtree('docs/_build', ignore_errors=True)"
sphinx-build -W -b html -d docs/_build/doctrees docs docs/_build/html
deps =
Sphinx
Expand Down