From 66001f401ac18576b3d2b5510128f6e90f6a3959 Mon Sep 17 00:00:00 2001 From: Heberto Mayorquin Date: Wed, 11 Sep 2024 17:30:50 -0600 Subject: [PATCH 1/4] make test base mixing per class instead of per test --- neo/test/rawiotest/common_rawio_test.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/neo/test/rawiotest/common_rawio_test.py b/neo/test/rawiotest/common_rawio_test.py index e0620f06b..224ff9d87 100644 --- a/neo/test/rawiotest/common_rawio_test.py +++ b/neo/test/rawiotest/common_rawio_test.py @@ -59,14 +59,15 @@ class BaseTestRawIO: local_test_dir = get_local_testing_data_folder() - def setUp(self): + @classmethod + def setUpClass(cls): """ - Set up the test fixture. This is run for every test + Set up the test fixture. This is run once before all tests. """ - self.shortname = self.rawioclass.__name__.lower().replace("rawio", "") + cls.shortname = cls.rawioclass.__name__.lower().replace("rawio", "") - if HAVE_DATALAD and self.use_network: - for remote_path in self.entities_to_download: + if HAVE_DATALAD and cls.use_network: + for remote_path in cls.entities_to_download: download_dataset(repo=repo_for_test, remote_path=remote_path) else: raise unittest.SkipTest("Requires datalad download of data from the web") From 19d55795ce576fbc3eefa158d6d5d392bd30c441 Mon Sep 17 00:00:00 2001 From: Heberto Mayorquin Date: Thu, 12 Sep 2024 09:25:25 -0600 Subject: [PATCH 2/4] fix maxwell --- neo/test/rawiotest/common_rawio_test.py | 2 +- neo/test/rawiotest/test_maxwellrawio.py | 19 +++++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/neo/test/rawiotest/common_rawio_test.py b/neo/test/rawiotest/common_rawio_test.py index 224ff9d87..98d48332d 100644 --- a/neo/test/rawiotest/common_rawio_test.py +++ b/neo/test/rawiotest/common_rawio_test.py @@ -52,7 +52,7 @@ class BaseTestRawIO: rawioclass = None # the IOclass to be tested entities_to_test = [] # list of files to test compliances - entities_to_download = [] # when files are at gin + entities_to_download = [] # when files a re at gin # allow environment to tell avoid using network use_network = can_use_network() diff --git a/neo/test/rawiotest/test_maxwellrawio.py b/neo/test/rawiotest/test_maxwellrawio.py index 59ee38212..88a9b612e 100644 --- a/neo/test/rawiotest/test_maxwellrawio.py +++ b/neo/test/rawiotest/test_maxwellrawio.py @@ -1,24 +1,27 @@ import unittest -import os from neo.rawio.maxwellrawio import MaxwellRawIO, auto_install_maxwell_hdf5_compression_plugin from neo.test.rawiotest.common_rawio_test import BaseTestRawIO +from neo.utils.datasets import download_dataset, default_testing_repo + +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 class TestMaxwellRawIO( BaseTestRawIO, unittest.TestCase, ): - rawioclass = MaxwellRawIO - entities_to_download = ["maxwell"] - entities_to_test = files_to_test = [ - "maxwell/MaxOne_data/Record/000011/data.raw.h5", - "maxwell/MaxTwo_data/Network/000028/data.raw.h5", - ] def setUp(self): auto_install_maxwell_hdf5_compression_plugin(force_download=False) - BaseTestRawIO.setUp(self) if __name__ == "__main__": From 810577cad85770d73468e1287f3abca21310395a Mon Sep 17 00:00:00 2001 From: Heberto Mayorquin Date: Thu, 12 Sep 2024 09:35:44 -0600 Subject: [PATCH 3/4] add class attribute removed accidentally --- neo/test/rawiotest/test_maxwellrawio.py | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/neo/test/rawiotest/test_maxwellrawio.py b/neo/test/rawiotest/test_maxwellrawio.py index 88a9b612e..aa4a30c7d 100644 --- a/neo/test/rawiotest/test_maxwellrawio.py +++ b/neo/test/rawiotest/test_maxwellrawio.py @@ -3,23 +3,19 @@ from neo.rawio.maxwellrawio import MaxwellRawIO, auto_install_maxwell_hdf5_compression_plugin from neo.test.rawiotest.common_rawio_test import BaseTestRawIO -from neo.utils.datasets import download_dataset, default_testing_repo - -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 class TestMaxwellRawIO( BaseTestRawIO, unittest.TestCase, ): + rawioclass = MaxwellRawIO + entities_to_download = ["maxwell"] + entities_to_test = files_to_test = [ + "maxwell/MaxOne_data/Record/000011/data.raw.h5", + "maxwell/MaxTwo_data/Network/000028/data.raw.h5", + ] + def setUp(self): auto_install_maxwell_hdf5_compression_plugin(force_download=False) From f88583324c3e30adce4131287b258450b0624d70 Mon Sep 17 00:00:00 2001 From: Heberto Mayorquin Date: Thu, 12 Sep 2024 10:24:51 -0600 Subject: [PATCH 4/4] Update neo/test/rawiotest/common_rawio_test.py Co-authored-by: Zach McKenzie <92116279+zm711@users.noreply.github.com> --- neo/test/rawiotest/common_rawio_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neo/test/rawiotest/common_rawio_test.py b/neo/test/rawiotest/common_rawio_test.py index 98d48332d..224ff9d87 100644 --- a/neo/test/rawiotest/common_rawio_test.py +++ b/neo/test/rawiotest/common_rawio_test.py @@ -52,7 +52,7 @@ class BaseTestRawIO: rawioclass = None # the IOclass to be tested entities_to_test = [] # list of files to test compliances - entities_to_download = [] # when files a re at gin + entities_to_download = [] # when files are at gin # allow environment to tell avoid using network use_network = can_use_network()