Skip to content

Commit

Permalink
Use pid for test database name in Django tests (#2998)
Browse files Browse the repository at this point in the history
* Using pid instead of random number
  • Loading branch information
antonpirker authored Apr 25, 2024
1 parent 534a301 commit d91a510
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions tests/integrations/django/myapp/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
https://docs.djangoproject.com/en/2.0/ref/settings/
"""

import random

# We shouldn't access settings while setting up integrations. Initialize SDK
# here to provoke any errors that might occur.
import sentry_sdk
Expand Down Expand Up @@ -128,7 +126,7 @@ def middleware(request):
"USER": os.environ.get("SENTRY_PYTHON_TEST_POSTGRES_USER", "postgres"),
"PASSWORD": os.environ.get("SENTRY_PYTHON_TEST_POSTGRES_PASSWORD", "sentry"),
"NAME": os.environ.get(
"SENTRY_PYTHON_TEST_POSTGRES_NAME", f"myapp_db_{random.randint(0, 1000)}"
"SENTRY_PYTHON_TEST_POSTGRES_NAME", f"myapp_db_{os.getpid()}"
),
}
except (ImportError, KeyError):
Expand Down

0 comments on commit d91a510

Please sign in to comment.