コード例 #1
0
ファイル: test_utils.py プロジェクト: nilearn-ci/nilearn
def setup_mock():
    global url_request
    url_request = mock_request()
    datasets.utils._urllib.request = url_request
    datasets.utils._chunk_read_ = wrap_chunk_read_(datasets.utils._chunk_read_)
    global file_mock
    file_mock = FetchFilesMock()
    datasets.utils._fetch_files = file_mock  # overwrite the actual function
コード例 #2
0
def setup_mock():
    global url_request
    url_request = mock_request()
    datasets._urllib.request = url_request
    datasets._chunk_read_ = wrap_chunk_read_(datasets._chunk_read_)
    global file_mock
    file_mock = FetchFilesMock()
    datasets._fetch_files = file_mock
コード例 #3
0
def setup_mock():
    global url_request
    url_request = mock_request()
    datasets._urllib.request = url_request
    datasets._chunk_read_ = wrap_chunk_read_(datasets._chunk_read_)
    global file_mock
    file_mock = FetchFilesMock()
    datasets._fetch_files = file_mock
コード例 #4
0
ファイル: test_utils.py プロジェクト: simudream/nilearn
def setup_mock():
    global url_request
    url_request = mock_request()
    datasets.utils._urllib.request = url_request
    datasets.utils._chunk_read_ = wrap_chunk_read_(datasets.utils._chunk_read_)
    global file_mock
    file_mock = FetchFilesMock()
    datasets.utils._fetch_files = file_mock  # overwrite the actual function
コード例 #5
0
def setup_mock():
    global url_mock
    url_mock = mock_urllib2()
    datasets.urllib2 = url_mock
    datasets._chunk_read_ = wrap_chunk_read_(datasets._chunk_read_)
    global file_mock
    file_mock = FetchFilesMock()
    datasets._fetch_files = file_mock
コード例 #6
0
ファイル: test_func.py プロジェクト: simudream/nilearn
def setup_mock():
    global original_url_request
    global mock_url_request
    mock_url_request = mock_request()
    original_url_request = utils._urllib.request
    utils._urllib.request = mock_url_request

    global original_chunk_read
    global mock_chunk_read
    mock_chunk_read = wrap_chunk_read_(utils._chunk_read_)
    original_chunk_read = utils._chunk_read_
    utils._chunk_read_ = mock_chunk_read

    global original_fetch_files
    global mock_fetch_files
    mock_fetch_files = FetchFilesMock()
    original_fetch_files = func._fetch_files
    func._fetch_files = mock_fetch_files
コード例 #7
0
ファイル: test_utils.py プロジェクト: Raniac/NEURO-LEARN
def setup_mock(utils_mod=datasets.utils, dataset_mod=datasets.utils):
    global original_url_request
    global mock_url_request
    mock_url_request = mock_request()
    original_url_request = utils_mod._urllib.request
    utils_mod._urllib.request = mock_url_request

    global original_chunk_read
    global mock_chunk_read
    mock_chunk_read = wrap_chunk_read_(utils_mod._chunk_read_)
    original_chunk_read = utils_mod._chunk_read_
    utils_mod._chunk_read_ = mock_chunk_read

    global original_fetch_files
    global mock_fetch_files
    mock_fetch_files = FetchFilesMock()
    original_fetch_files = dataset_mod._fetch_files
    dataset_mod._fetch_files = mock_fetch_files