Screenshoots with pytests amd dataclass fields dynamicaly and literal choices

Take screenshot of full page with Selenium Python with chromedriver

How to capture screenshot on test case failure with PyTest

Dataclass argument choices with a default option

from dataclasses import dataclass
from typing import Literal

class Person:
    name: Literal['Eric', 'John', 'Graham', 'Terry'] = 'Eric'

Dynamically add fields to dataclass objects

class X:
    i: int

x = X(i=42)
x.__class__ = make_dataclass('Y', fields=[('s', str)], bases=(X,))
x.s = 'text'

# {'i': 42, 's': 'text'}

Смотри еще: