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

Use Django's --keepdb with Django 1.8+ #261

Merged
merged 1 commit into from
Dec 5, 2015

Conversation

blueyed
Copy link
Contributor

@blueyed blueyed commented Sep 14, 2015

Django 1.8 supports --keepdb [1], and it makes sense to make use of
it. This should probably handle migrations in the context of
transactional_db better, i.e. by re-applying migrations with a flushed
DB.

1: https://docs.djangoproject.com/en/1.8/ref/django-admin/#django-admin-option---keepdb

@blueyed
Copy link
Contributor Author

blueyed commented Sep 15, 2015

Please note that this will change the errors you will see when the test database cannot be created on PostgreSQL, because Django will ignore the error from CREATE DATABASE with --keepdb.

Reported for Django at https://code.djangoproject.com/ticket/25406.

@landscape-bot
Copy link

Code Health
Code quality remained the same when pulling 93fca47 on blueyed:use-keepdb-dj18 into b9eb210 on pytest-dev:master.

Django 1.8 supports `--keepdb` [1], and it makes sense to make use of
it.  This should probably handle migrations in the context of
`transactional_db` better, i.e. by re-applying migrations with a flushed
DB.

1: https://docs.djangoproject.com/en/1.8/ref/django-admin/#django-admin-option---keepdb
@landscape-bot
Copy link

Code Health
Code quality remained the same when pulling a5452b6 on blueyed:use-keepdb-dj18 into d3e03b9 on pytest-dev:master.

@pelme
Copy link
Member

pelme commented Oct 5, 2015

This is great! Is this fully backward compatible with our old monkey patching? (I guess it is since all tests passes)

I think we should deprecate --reuse-db and just stick with --keepdb and follow the Django conventions. In some distant future we can just drop our own monkey patches altogether and use Django's builtin support. :)

@blueyed
Copy link
Contributor Author

blueyed commented Oct 5, 2015

I think we should deprecate --reuse-db and just stick with --keepdb

👍

Will you do it?

@pelme
Copy link
Member

pelme commented Oct 5, 2015

I'd like to get a new release out and will focus on that for now, but I can give it a shot after that if you or no-one else gets there before me :)

@pelme
Copy link
Member

pelme commented Oct 5, 2015

(I have no problem merging this before btw, we can do the deprecation in a separate PR)

@blueyed
Copy link
Contributor Author

blueyed commented Oct 5, 2015

Is this fully backward compatible with our old monkey patching?

The errors are different, because it triggers a bug in Django (#261 (comment)).

Maybe it is better to not mess with it for the next release then?

@agamdua
Copy link

agamdua commented Oct 21, 2015

This would be a really cool thing to have - I would like to drop pytest in a project I'm on now, but its dependent on the --keepdb flag.

I guess this is conditional on a solution to https://code.djangoproject.com/ticket/25406.. Can I help in any way?

pelme added a commit that referenced this pull request Dec 5, 2015
Use Django's `--keepdb` with Django 1.8+
@pelme pelme merged commit 4ebff28 into pytest-dev:master Dec 5, 2015
@pelme
Copy link
Member

pelme commented Dec 5, 2015

I have merged this now but not deprecated --reuse-db yet.

@agamdua You can already get the same functionality with --reuse-db (and it has been possible for quite some time). This PR is about using the Django implementation for database reuse rather than our own. :)

@blueyed blueyed deleted the use-keepdb-dj18 branch December 5, 2015 17:40
@jmbowman jmbowman mentioned this pull request Feb 10, 2016
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.

4 participants