Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid error in FileInfo repr due to permissions being None #956

Merged
merged 1 commit into from
Jun 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ops/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
_StringOrPath = Union[str, pathlib.PurePosixPath, pathlib.Path]
_FileOrDir = Union['_File', '_Directory']
_FileKwargs = TypedDict('_FileKwargs', {
'permissions': int,
'permissions': Optional[int],
'last_modified': datetime.datetime,
'user_id': Optional[int],
'user': Optional[str],
Expand Down Expand Up @@ -2476,7 +2476,7 @@ def get_pebble_file_type(file: '_FileOrDir') -> pebble.FileType:
name=file.name,
type=get_pebble_file_type(file),
size=file.size if isinstance(file, _File) else None,
permissions=file.kwargs.get('permissions'),
permissions=file.kwargs.get('permissions') or 0,
last_modified=file.last_modified,
user_id=file.kwargs.get('user_id'),
user=file.kwargs.get('user'),
Expand Down