Skip to content

Db copy #38

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

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,23 @@
TESTS_DIR = py.path.local(__file__)


from django.conf import settings

@pytest.fixture()
def django_settings():
from django.conf import settings
return settings


from .db_helpers import create_empty_production_database, get_db_engine, DB_NAME


@pytest.fixture(scope='function')
def django_testdir(testdir, monkeypatch):
def django_testdir(testdir, monkeypatch, django_settings):
if get_db_engine() in ('mysql', 'postgresql_psycopg2'):
# Django requires the production database to exists..
create_empty_production_database()

db_settings = copy.deepcopy(settings.DATABASES)
db_settings = copy.deepcopy(django_settings.DATABASES)
db_settings['default']['NAME'] = DB_NAME

test_settings = '''
Expand Down
3 changes: 2 additions & 1 deletion tests/settings_postgres.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'pytest_django',
'HOST': 'localhost',
'HOST': None,
#'HOST': 'localhost',
'USER': '',
},
}