Selfie
Loading...
Searching...
No Matches
pytest_selfie.SelfieSettingsAPI.SelfieSettingsAPI Class Reference
Inheritance diagram for pytest_selfie.SelfieSettingsAPI.SelfieSettingsAPI:
pytest_selfie.SelfieSettingsAPI.SelfieSettingsSmuggleError

Public Member Functions

 __init__ (self, pytest.Config config)
 
bool allow_multiple_equivalent_writes_to_one_location (self)
 
Optional[str] snapshot_folder_name (self)
 
Path root_folder (self)
 
Mode calc_mode (self)
 

Public Attributes

 root_dir
 

Detailed Description

API for configuring the selfie plugin, you can set its values like this https://docs.pytest.org/en/7.1.x/reference/customize.html#configuration-file-formats

Definition at line 9 of file SelfieSettingsAPI.py.

Constructor & Destructor Documentation

◆ __init__()

pytest_selfie.SelfieSettingsAPI.SelfieSettingsAPI.__init__ (   self,
pytest.Config  config 
)

Reimplemented in pytest_selfie.SelfieSettingsAPI.SelfieSettingsSmuggleError.

Definition at line 12 of file SelfieSettingsAPI.py.

12 def __init__(self, config: pytest.Config):
13 self.root_dir = config.rootpath
14

Member Function Documentation

◆ allow_multiple_equivalent_writes_to_one_location()

bool pytest_selfie.SelfieSettingsAPI.SelfieSettingsAPI.allow_multiple_equivalent_writes_to_one_location (   self)
Allow multiple equivalent writes to one location.

Definition at line 16 of file SelfieSettingsAPI.py.

16 def allow_multiple_equivalent_writes_to_one_location(self) -> bool:
17 """Allow multiple equivalent writes to one location."""
18 return True
19

◆ calc_mode()

Mode pytest_selfie.SelfieSettingsAPI.SelfieSettingsAPI.calc_mode (   self)

Definition at line 30 of file SelfieSettingsAPI.py.

30 def calc_mode(self) -> Mode:
31 override = os.getenv("selfie") or os.getenv("SELFIE") # noqa: SIM112
32 if override:
33 # Convert the mode to lowercase and match it with the Mode enum
34 try:
35 return Mode[override.lower()]
36 except KeyError:
37 raise ValueError(f"No such mode: {override}") from None
38
39 ci = os.getenv("ci") or os.getenv("CI") # noqa: SIM112
40 if ci and ci.lower() == "true":
41 return Mode.readonly
42 else:
43 return Mode.interactive
44
45

◆ root_folder()

Path pytest_selfie.SelfieSettingsAPI.SelfieSettingsAPI.root_folder (   self)
Returns the root folder for storing snapshots. Set by https://docs.pytest.org/en/7.1.x/reference/customize.html#finding-the-rootdir

Definition at line 26 of file SelfieSettingsAPI.py.

26 def root_folder(self) -> Path:
27 """Returns the root folder for storing snapshots. Set by https://docs.pytest.org/en/7.1.x/reference/customize.html#finding-the-rootdir"""
28 return self.root_dir
29

◆ snapshot_folder_name()

Optional[str] pytest_selfie.SelfieSettingsAPI.SelfieSettingsAPI.snapshot_folder_name (   self)
Defaults to None, which means that snapshots are stored right next to the test that created them.

Definition at line 21 of file SelfieSettingsAPI.py.

21 def snapshot_folder_name(self) -> Optional[str]:
22 """Defaults to None, which means that snapshots are stored right next to the test that created them."""
23 return None
24

Member Data Documentation

◆ root_dir

pytest_selfie.SelfieSettingsAPI.SelfieSettingsAPI.root_dir

Definition at line 13 of file SelfieSettingsAPI.py.


The documentation for this class was generated from the following file: