pytest-bdd-example/tests/fixtures/entry.py

23 lines
392 B
Python
Raw Permalink Normal View History

2013-11-10 19:52:14 +08:00
import pytest
import datetime
@pytest.fixture
def title():
return "Entry for {0}".format(datetime.datetime.now())
@pytest.fixture
def text():
"""Entry text."""
return "Hello world text!"
@pytest.fixture
def entry(db, title, text):
"""Blog entry."""
db.execute('insert into entries (title, text) values (?, ?)', [title, text])
db.commit()
return title, text