pytest-dev / pytest-dev/pytest-django
Spatialite backed test databases are not allowed to be :memory: based
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.5k
- Forks
- 367
- PR merge metrics
- No merged PRs in 30d
Description
On my test settings I have this DATABASES config:
DATABASES = {
'default': {
'ENGINE': 'django.contrib.gis.db.backends.spatialite',
'NAME': ':memory:',
}
}
As I'm not using exactly sqlite as engine, pytest-django renames my DB by preppending test_, while I want to use ":memory:". This causes the tear-down to fail, as sqlite/spatialite wants to delete the db file.
I managed to go around this issue by overriding the django_db_modify_db_settings_xdist_suffix fixture to allow using :memory: for spatialite.
Having said that... I'm not 100% sure I can use :memory: with spatialite.
Django==1.10
pytest==3.0.3
pytest-django==3.0.0
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at pytest_django/fixtures.py around line 35 and the django_db_modify_db_settings_xdist_suffix fixture, then reproduce teardown with the shown Spatialite :memory: configuration. Confirm whether :memory: is supported and consider the work complete when the configuration no longer triggers the database rename or deletion failure.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- django, python, sqlite
- Domain
- database, testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100