Closed
Description
Here is my test code:
import pytest
pytestmark = pytest.mark.django_db
from handy.db import do_sql, fetch_val
def setup_module(fetch_val):
print 1
do_sql('''
create table test (
id int primary key,
tag int not null
);
insert into test values (1, 10), (2, 20);
''')
print 2
def test_fetch_val():
print 3
assert fetch_val('select min(id) from test') == 1
And I get DatabaseError: relation "test" does not exist
from test_fetch_val()
. I also get
1
2
Creating test database for alias 'default'...
3
captured output. Looks like setup_module()
is called before database is created.
Metadata
Metadata
Assignees
Labels
No labels