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

Adding custom database name for testing.postgres #21

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

camiloribeiro
Copy link

Just implementing a simple feature that I need and giving it back to you :)

@RazerM
Copy link

RazerM commented Oct 18, 2017

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',
Copy link

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',
Copy link

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'])
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants