pytest-dev / pytest-dev/pytest-django

Raise warning when using SQLite3 in-memory test database with --reuse-db

Open
#160 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
1.5k
Forks
367
PR merge metrics
No merged PRs in 30d

Description

Currently I've running several unittests with py.test that needs a database. The tests working fine.
But I#ve running with --reuse-dband the following database settings:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': 'db.sqlite3'
    }
}

The Tests will work fine, but the databse db.sqlite3 won't getting created / the file is missing while the tests run / after the tests.
I use django unittests and run py.test with the following: py.test -v -s --ds=envisia.test.settings --reuse-db also I'm running on Python 3.4.1, pytest 2.6.1 and Django 1.7rc2.
On PostgreSQL the database will be created and will exists..

Edit: Also PostgreSQL tests run faster even when I run sqlite3 on :memory: which is somehow strange?! But I think that's cause of PostgreSQL --reuse-db works.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with the shown SQLite settings and py.test -v -s --ds=envisia.test.settings --reuse-db command, then trace the plugin's handling of SQLite and --reuse-db. Done means the incompatible in-memory or file-backed behavior is detected and a clear warning is raised; add or update a regression test for that case.

Written by the indexing model from the issue text.

Assessment

Tech stack
django, python
Domain
database, testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.