Skip to content

Instantly share code, notes, and snippets.

@tuantranf
tuantranf / mock_multiprocess_pool.md
Last active April 2, 2026 12:46
mocking multiprocess pool for unittest

Mocking multiprocess pool apply_async method

It seems python multiprocessing interface relies on pickling, and mock library and pickling don't go well together.

write mock of multiprocess class for pytest

module code

pool = Pool(cpu_count())
pool.apply_async(func=myfunc)
@rattrayalex
rattrayalex / MessageStore_FluxBone.js
Last active June 19, 2020 09:40
Flux and Backbone
var ChatAppDispatcher = require('../dispatcher/ChatAppDispatcher');
var ChatConstants = require('../constants/ChatConstants');
var ChatMessageUtils = require('../utils/ChatMessageUtils');
var EventEmitter = require('events').EventEmitter;
var ThreadStore = require('../stores/ThreadStore');
var merge = require('react/lib/merge');
var ActionTypes = ChatConstants.ActionTypes;
var CHANGE_EVENT = 'change';