ibmdb / python-ibmdb-django

IBM DB2 Driver for the Django application Framework
Apache License 2.0
29 stars 42 forks source link

The --keepdb flag is not respected for test databases #104

Open boc-tdunn opened 1 month ago

boc-tdunn commented 1 month ago

The django docs state that the --keepdb flag should keep the test database from being destroyed after a test run, and that subsequent test runs should not recreate the test database if it exists already.

https://docs.djangoproject.com/en/5.1/topics/testing/overview/#the-test-database

For reference the POSTGRES django adapter does this.

https://github.com/django/django/blob/main/django/db/backends/postgresql/creation.py#L42-L45

boc-tdunn commented 1 month ago

Somewhat related issue is that Django allows you to provide the name of the test database: https://docs.djangoproject.com/en/5.1/ref/settings/#std-setting-DATABASE-TEST

But python-ibmdb-django always uses this format instead: https://github.com/ibmdb/python-ibmdb-django/blob/master/ibm_db_django/creation.py#L169

For reference this is what BaseDatabaseCreation does in django: https://github.com/django/django/blob/main/django/db/backends/base/creation.py#L185-L186

If you'd rather this be a separate issue let me know and I'll do that instead.

praveen-db2 commented 1 month ago

@boc-tdunn usually customers wont keep test database hence we ignored this option. We will handle this in coming releases.

boc-tdunn commented 1 month ago

I can't promise anything but would this be an issue you would accept a contribution for?

praveen-db2 commented 1 month ago

I didnt understand.

boc-tdunn commented 1 month ago

Would I be allowed to submit a Pull Request for this issue?

praveen-db2 commented 1 month ago

yes sure, we appreciate everybody's contribution. But we merge it when we plan for next release.