Fix inode creation issue on MacOS

This commit is contained in:
R. Richard 2019-08-14 16:05:55 +02:00
parent a97a4f4b12
commit 2fb971d317

View File

@ -3,8 +3,9 @@ from enum import Enum
from dataclasses import dataclass from dataclasses import dataclass
from json import dumps from json import dumps
from secrets import token_urlsafe from secrets import token_urlsafe
from os import urandom, mkfifo, mkdir, mknod from os import urandom, mkfifo, mkdir
from os.path import join from os.path import join
from pathlib import Path
from tempfile import TemporaryDirectory from tempfile import TemporaryDirectory
from tfw.internals.inotify import InotifyFileCreatedEvent, InotifyFileDeletedEvent from tfw.internals.inotify import InotifyFileCreatedEvent, InotifyFileDeletedEvent
@ -141,13 +142,13 @@ def test_broadcast(mock_context):
for path in paths: for path in paths:
assert mock_context.pipes.recv_pipes[path].messages[-1] == payload assert mock_context.pipes.recv_pipes[path].messages[-1] == payload
def test_inode_types(mock_context): def test_inode_types(mock_context):
touch = lambda path: Path(path).touch()
cases = [ cases = [
(Action.RECV, mock_context.pipes.recv_pipes, mkdir), (Action.RECV, mock_context.pipes.recv_pipes, mkdir),
(Action.SEND, mock_context.pipes.send_pipes, mkdir), (Action.SEND, mock_context.pipes.send_pipes, mkdir),
(Action.RECV, mock_context.pipes.recv_pipes, mknod), (Action.RECV, mock_context.pipes.recv_pipes, touch),
(Action.SEND, mock_context.pipes.send_pipes, mknod) (Action.SEND, mock_context.pipes.send_pipes, touch)
] ]
for action, pipes, creator in cases: for action, pipes, creator in cases: