File tree Expand file tree Collapse file tree 2 files changed +16
-8
lines changed
Expand file tree Collapse file tree 2 files changed +16
-8
lines changed Original file line number Diff line number Diff line change 1919
2020import logging
2121import unittest
22+ import importlib .util
23+ import warnings
2224
2325from neo .utils .datasets import download_dataset , get_local_testing_data_folder , default_testing_repo
2426
2527from neo .test .rawiotest .tools import can_use_network
2628
2729from neo .test .rawiotest import rawio_compliance as compliance
2830
29- try :
30- import datalad
31-
31+ datalad_spec = importlib .util .find_spec ("datalad" )
32+ if datalad_spec is not None :
3233 HAVE_DATALAD = True
33- except :
34+ else :
3435 HAVE_DATALAD = False
36+ warnings .warn ("datalad failure" )
3537
3638# url_for_tests = "https://portal.g-node.org/neo/" #This is the old place
3739repo_for_test = default_testing_repo
Original file line number Diff line number Diff line change 44
55import logging
66import os
7+ import importlib .util
8+
79
810logger = logging .getLogger ("neo.test" )
911
@@ -13,14 +15,18 @@ def can_use_network():
1315 Return True if network access is allowed
1416 """
1517
18+ # env variable for local dev
1619 if os .environ .get ("NEO_TESTS_NO_NETWORK" , False ):
1720 return False
18- try :
19- import datalad
20-
21+
22+ # check for datalad presence
23+ datalad_spec = importlib .util .find_spec ("datalad" )
24+ if datalad_spec is not None :
2125 HAVE_DATALAD = True
22- except :
26+ else :
2327 HAVE_DATALAD = False
28+
2429 if not HAVE_DATALAD :
2530 return False
31+
2632 return True
You can’t perform that action at this time.
0 commit comments