Loading...
Loading...
pytest Python testing framework with fixtures. Use for Python testing.
npx skill4agent add g1joshi/agent-skills pytestassert x == y# content of test_sample.py
def inc(x):
return x + 1
def test_answer():
assert inc(3) == 5pytestimport pytest
@pytest.fixture
def database():
db = connect_db()
yield db
db.close()
def test_insert(database):
database.insert("user")
assert database.count() == 1@pytest.mark.parametrize("input,expected", [
("3+5", 8),
("2+4", 6),
])
def test_eval(input, expected):
assert eval(input) == expectedconftest.pypytest-covpytest --cov=src@pytest.mark.slowpytest -m "not slow"unittest.TestCase