Skip to content

Commit

Permalink
Merge pull request #1553 from h-mayorquin/make_base_test_setup
Browse files Browse the repository at this point in the history
Make  `BaseTestRawIO` setup per class and not per test
  • Loading branch information
zm711 authored Sep 13, 2024
2 parents c4b67c8 + f885833 commit e8ea631
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
11 changes: 6 additions & 5 deletions neo/test/rawiotest/common_rawio_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
3 changes: 1 addition & 2 deletions neo/test/rawiotest/test_maxwellrawio.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
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
Expand All @@ -9,6 +8,7 @@ class TestMaxwellRawIO(
BaseTestRawIO,
unittest.TestCase,
):

rawioclass = MaxwellRawIO
entities_to_download = ["maxwell"]
entities_to_test = files_to_test = [
Expand All @@ -18,7 +18,6 @@ class TestMaxwellRawIO(

def setUp(self):
auto_install_maxwell_hdf5_compression_plugin(force_download=False)
BaseTestRawIO.setUp(self)


if __name__ == "__main__":
Expand Down

0 comments on commit e8ea631

Please sign in to comment.