Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make BaseTestRawIO setup per class and not per test #1553

Merged
merged 4 commits into from
Sep 13, 2024
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
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
Loading