-
Notifications
You must be signed in to change notification settings - Fork 46
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
Adding custom database name for testing.postgres #21
base: master
Are you sure you want to change the base?
Conversation
I would like to see this merged (I'm not affiliated with the project), can I help somehow? |
@@ -25,7 +25,7 @@ | |||
|
|||
setup( | |||
name='testing.postgresql', | |||
version='1.3.0', | |||
version='1.3.1', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would be a minor release, not a patch release, but the version bump should be left out of the PR anyway.
@@ -42,6 +42,7 @@ class Postgresql(Database): | |||
postgres_args='-h 127.0.0.1 -F -c logging_collector=off', | |||
pid=None, | |||
port=None, | |||
database='test', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be clearer to call this parameter db_name
like #18
@@ -99,9 +101,9 @@ def poststart(self): | |||
with closing(pg8000.connect(**self.dsn(database='postgres'))) as conn: | |||
conn.autocommit = True | |||
with closing(conn.cursor()) as cursor: | |||
cursor.execute("SELECT COUNT(*) FROM pg_database WHERE datname='test'") | |||
cursor.execute("SELECT COUNT(*) FROM pg_database WHERE datname='%s'" % self.settings['database']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The database name should be passed as a parameter to execute, instead of string interpolation.
Just implementing a simple feature that I need and giving it back to you :)