File tree Expand file tree Collapse file tree 3 files changed +10
-0
lines changed
Expand file tree Collapse file tree 3 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -77,6 +77,7 @@ def set_default_dataset(dataset_id=None):
7777 dataset_id = os .getenv (_DATASET_ENV_VAR_NAME )
7878
7979 if dataset_id is not None :
80+ _implicit_environ .DATASET_ID = dataset_id
8081 _implicit_environ .DATASET = get_dataset (dataset_id )
8182
8283
Original file line number Diff line number Diff line change 88"""
99
1010
11+ DATASET_ID = None
12+ """Module global to allow persistent implied dataset ID from enviroment."""
13+
1114DATASET = None
1215"""Module global to allow persistent implied dataset from enviroment."""
1316
Original file line number Diff line number Diff line change @@ -73,20 +73,26 @@ def custom_get_dataset(local_dataset_id):
7373
7474 def test_set_from_env_var (self ):
7575 from gcloud .datastore import _DATASET_ENV_VAR_NAME
76+ from gcloud .datastore import _implicit_environ
7677
7778 # Make a custom getenv function to Monkey.
7879 DATASET = 'dataset'
7980 VALUES = {
8081 _DATASET_ENV_VAR_NAME : DATASET ,
8182 }
8283 self ._test_with_environ (VALUES , DATASET )
84+ self .assertEqual (_implicit_environ .DATASET_ID , DATASET )
8385
8486 def test_no_env_var_set (self ):
87+ from gcloud .datastore import _implicit_environ
8588 self ._test_with_environ ({}, None )
89+ self .assertEqual (_implicit_environ .DATASET_ID , None )
8690
8791 def test_set_explicit (self ):
92+ from gcloud .datastore import _implicit_environ
8893 DATASET_ID = 'DATASET'
8994 self ._test_with_environ ({}, DATASET_ID , dataset_id = DATASET_ID )
95+ self .assertEqual (_implicit_environ .DATASET_ID , DATASET_ID )
9096
9197
9298class Test_set_default_connection (unittest2 .TestCase ):
You can’t perform that action at this time.
0 commit comments