def test_is_socket(self): file_path = os.path.join(self.files.rootdir, self.filename) sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) sock.bind(file_path) self.assertTrue(is_special_file(file_path))
def test_is_fifo(self): file_path = os.path.join(self.files.rootdir, self.filename) mode = 0o600 | stat.S_IFIFO os.mknod(file_path, mode) self.assertTrue(is_special_file(file_path))
def test_is_block_device(self): file_path = os.path.join(self.files.rootdir, self.filename) self.files.create_file(self.filename, contents='') with mock.patch('stat.S_ISBLK') as mock_class: mock_class.return_value = True self.assertTrue(is_special_file(file_path))