File Testing¶
provide.testkit.file
¶
File testing fixtures for the provide-io ecosystem.
Standard fixtures for file and directory operations that can be used across any project that depends on provide.foundation.
Functions¶
binary_file
¶
Create a temporary binary file for testing.
Yields:
| Type | Description |
|---|---|
Path
|
Path to a binary file containing sample binary data. |
Source code in provide/testkit/file/special_fixtures.py
empty_directory
¶
nested_directory_structure
¶
Create a deeply nested directory structure for testing.
Creates
- level1/
- level2/
- level3/
- deep_file.txt
- level3/
- file_l2.txt
- level2/
- file_l1.txt
Yields:
| Type | Description |
|---|---|
Path
|
Path to the root of the structure. |
Source code in provide/testkit/file/directory_fixtures.py
readonly_file
¶
Create a read-only file for permission testing.
Yields:
| Type | Description |
|---|---|
Path
|
Path to a read-only file. |
Source code in provide/testkit/file/special_fixtures.py
temp_binary_file
¶
Create temporary binary files.
Returns:
| Type | Description |
|---|---|
None
|
Function that creates binary files. |
Source code in provide/testkit/file/content_fixtures.py
temp_csv_file
¶
Create temporary CSV files for testing.
Returns:
| Type | Description |
|---|---|
None
|
Function that creates CSV files. |
Source code in provide/testkit/file/content_fixtures.py
temp_directory
¶
Create a temporary directory that's cleaned up after test.
Yields:
| Type | Description |
|---|---|
Path
|
Path to the temporary directory. |
Source code in provide/testkit/file/directory_fixtures.py
temp_executable_file
¶
Create temporary executable files for testing.
Returns:
| Type | Description |
|---|---|
None
|
Function that creates executable files. |
Source code in provide/testkit/file/special_fixtures.py
temp_file
¶
Create a temporary file factory with optional content.
Returns:
| Type | Description |
|---|---|
None
|
A function that creates temporary files with specified content and suffix. |
Source code in provide/testkit/file/content_fixtures.py
temp_file_with_content
¶
Create temporary files with specific content.
Returns:
| Type | Description |
|---|---|
None
|
Function that creates files with content. |
Source code in provide/testkit/file/content_fixtures.py
temp_json_file
¶
Create temporary JSON files for testing.
Returns:
| Type | Description |
|---|---|
None
|
Function that creates JSON files. |
Source code in provide/testkit/file/content_fixtures.py
temp_named_file
¶
Create a named temporary file factory.
Returns:
| Type | Description |
|---|---|
None
|
Function that creates named temporary files. |
Source code in provide/testkit/file/content_fixtures.py
temp_symlink
¶
Create temporary symbolic links for testing.
Returns:
| Type | Description |
|---|---|
None
|
Function that creates symbolic links. |
Source code in provide/testkit/file/special_fixtures.py
test_files_structure
¶
Create standard test file structure with files and subdirectories.
Creates
- source/
- file1.txt (contains "Content 1")
- file2.txt (contains "Content 2")
- subdir/
- file3.txt (contains "Content 3")
Yields:
| Type | Description |
|---|---|
tuple[Path, Path]
|
Tuple of (temp_path, source_path) |
Source code in provide/testkit/file/directory_fixtures.py
๐ค AI-Generated Content
This documentation was generated with AI assistance and is still being audited. Some, or potentially a lot, of this information may be inaccurate. Learn more.
options:
show_source: true
show_root_heading: true
members_order: source
show_if_no_docstring: false
filters:
- "!^_"
- "^__init__$"