Skip to content
Merged
Show file tree
Hide file tree
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
7 changes: 6 additions & 1 deletion neo/test/iotest/common_io_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,13 @@
from neo.test.rawiotest.tools import can_use_network
from neo.test.rawiotest.common_rawio_test import repo_for_test
from neo.utils import (download_dataset,
get_local_testing_data_folder, HAVE_DATALAD)
get_local_testing_data_folder)

try:
import datalad
HAVE_DATALAD = True
except:
HAVE_DATALAD = False

from neo.test.iotest.tools import (cleanup_test_file,
close_object_safe, create_generic_io_object,
Expand Down
7 changes: 6 additions & 1 deletion neo/test/rawiotest/common_rawio_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,17 @@
import unittest

from neo.utils.datasets import (download_dataset,
get_local_testing_data_folder, HAVE_DATALAD, default_testing_repo)
get_local_testing_data_folder, default_testing_repo)

from neo.test.rawiotest.tools import can_use_network

from neo.test.rawiotest import rawio_compliance as compliance

try:
import datalad
HAVE_DATALAD = True
except:
HAVE_DATALAD = False

# url_for_tests = "https://portal.g-node.org/neo/" #This is the old place
repo_for_test = default_testing_repo
Expand Down
7 changes: 5 additions & 2 deletions neo/test/rawiotest/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,18 @@
import logging
import os

from neo.utils import HAVE_DATALAD

logger = logging.getLogger("neo.test")


def can_use_network():
"""
Return True if network access is allowed
"""
try:
import datalad
HAVE_DATALAD = True
except:
HAVE_DATALAD = False
if not HAVE_DATALAD:
return False
if os.environ.get('NOSETESTS_NO_NETWORK', False):
Expand Down
3 changes: 1 addition & 2 deletions neo/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@
from .misc import (get_events, get_epochs, add_epoch,
match_events, cut_block_by_epochs, cut_segment_by_epoch,
is_block_rawio_compatible)
from .datasets import (download_dataset,
get_local_testing_data_folder, HAVE_DATALAD)
from .datasets import download_dataset, get_local_testing_data_folder
11 changes: 2 additions & 9 deletions neo/utils/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,6 @@
import os
from pathlib import Path

try:
import datalad.api
from datalad.support.gitrepo import GitRepo

HAVE_DATALAD = True
except:
HAVE_DATALAD = False

default_testing_repo = 'https://gin.g-node.org/NeuralEnsemble/ephy_testing_data'

global local_testing_data_folder
Expand Down Expand Up @@ -59,7 +51,8 @@ def download_dataset(repo=default_testing_repo, remote_path=None,
local_path:
The local path of the downloaded file or folder
"""
assert HAVE_DATALAD, 'You need to install datalad'
import datalad.api
from datalad.support.gitrepo import GitRepo

if local_folder is None:
global local_testing_data_folder
Expand Down