File tree Expand file tree Collapse file tree
packages/django-google-spanner/tests Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2828
2929PROJECT_ID = os .getenv ("GOOGLE_CLOUD_PROJECT" , "emulator-test-project" )
3030
31- # _get_test_db_name method in creation.py addes prefix of 'test_' to db name.
32- DATABASE_NAME = os .getenv ("DJANGO_SPANNER_DB" , "django_test_db" )
31+ # Lock a unique database name into the environment so utils.py sees the exact same name
32+ if "DJANGO_SPANNER_DB" not in os .environ :
33+ os .environ ["DJANGO_SPANNER_DB" ] = f"db_{ uuid .uuid4 ().hex [:8 ]} "
34+
35+ DATABASE_NAME = os .environ ["DJANGO_SPANNER_DB" ]
3336
3437DATABASES = {
3538 "default" : {
Original file line number Diff line number Diff line change 2727 "GOOGLE_CLOUD_TESTS_SPANNER_INSTANCE" , "spanner-django-python-systest"
2828)
2929PROJECT_ID = os .getenv ("GOOGLE_CLOUD_PROJECT" , "emulator-test-project" )
30- DATABASE_NAME = os .getenv ("DJANGO_SPANNER_DB" , "django_test_db" )
30+
31+ # Lock a unique database name into the environment so settings.py sees the exact same name
32+ if "DJANGO_SPANNER_DB" not in os .environ :
33+ os .environ ["DJANGO_SPANNER_DB" ] = f"db_{ uuid .uuid4 ().hex [:8 ]} "
34+
35+ DATABASE_NAME = os .environ ["DJANGO_SPANNER_DB" ]
3136
3237
3338class Config (object ):
You can’t perform that action at this time.
0 commit comments