Selfie
Loading...
Searching...
No Matches
pytest_selfie.plugin.PytestSnapshotFileLayout Class Reference
Inheritance diagram for pytest_selfie.plugin.PytestSnapshotFileLayout:
selfie_lib.WriteTracker.SnapshotFileLayout

Public Member Functions

 __init__ (self, FSImplementation fs, SelfieSettingsAPI settings)
 
TypedPath root_folder (self)
 
TypedPath snapshotfile_for_testfile (self, TypedPath testfile)
 
- Public Member Functions inherited from selfie_lib.WriteTracker.SnapshotFileLayout
TypedPath sourcefile_for_call (self, CallLocation call)
 

Public Attributes

 unix_newlines
 
- Public Attributes inherited from selfie_lib.WriteTracker.SnapshotFileLayout
 fs
 

Detailed Description

Definition at line 65 of file plugin.py.

Constructor & Destructor Documentation

◆ __init__()

pytest_selfie.plugin.PytestSnapshotFileLayout.__init__ (   self,
FSImplementation  fs,
SelfieSettingsAPI  settings 
)

Reimplemented from selfie_lib.WriteTracker.SnapshotFileLayout.

Definition at line 66 of file plugin.py.

66 def __init__(self, fs: FSImplementation, settings: SelfieSettingsAPI):
67 super().__init__(fs)
68 self.__settings = settings
69 self.__root_folder = TypedPath.of_folder(os.path.abspath(settings.root_dir))
70 self.unix_newlines = self.__infer_default_line_ending_is_unix()
71

Member Function Documentation

◆ root_folder()

TypedPath pytest_selfie.plugin.PytestSnapshotFileLayout.root_folder (   self)

Reimplemented from selfie_lib.WriteTracker.SnapshotFileLayout.

Definition at line 72 of file plugin.py.

72 def root_folder(self) -> TypedPath:
73 return self.__root_folder
74

◆ snapshotfile_for_testfile()

TypedPath pytest_selfie.plugin.PytestSnapshotFileLayout.snapshotfile_for_testfile (   self,
TypedPath  testfile 
)

Definition at line 75 of file plugin.py.

75 def snapshotfile_for_testfile(self, testfile: TypedPath) -> TypedPath:
76 if testfile.name.endswith(".py"):
77 return testfile.parent_folder().resolve_file(f"{testfile.name[:-3]}.ss")
78 else:
79 raise ValueError(f"Unknown file extension, expected .py: {testfile.name}")
80

Member Data Documentation

◆ unix_newlines

pytest_selfie.plugin.PytestSnapshotFileLayout.unix_newlines

Definition at line 70 of file plugin.py.


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