File: conftest.py

package info (click to toggle)
python-marshmallow 3.26.1-0.2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 1,280 kB
  • sloc: python: 11,513; makefile: 11; sh: 8
file content (27 lines) | stat: -rw-r--r-- 566 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
"""Pytest fixtures that are available in all test modules."""

import pytest

from tests.base import Blog, User, UserSchema


@pytest.fixture
def user():
    return User(name="Monty", age=42.3, homepage="http://monty.python.org/")


@pytest.fixture
def blog(user):
    col1 = User(name="Mick", age=123)
    col2 = User(name="Keith", age=456)
    return Blog(
        "Monty's blog",
        user=user,
        categories=["humor", "violence"],
        collaborators=[col1, col2],
    )


@pytest.fixture
def serialized_user(user):
    return UserSchema().dump(user)