Skip to content

Commit

Permalink
Merge e8e1aad into 78c802c
Browse files Browse the repository at this point in the history
  • Loading branch information
jpgill86 committed Mar 1, 2020
2 parents 78c802c + e8e1aad commit 9fd6435
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 5 deletions.
2 changes: 1 addition & 1 deletion neurotic/gui/config.py
Expand Up @@ -305,7 +305,7 @@ def create_ephyviewer_window(self, theme='light', support_increased_line_width=F

_set_defaults_for_plots(self.metadata, self.blk)

if self.is_shown('traces'):
if self.is_shown('traces') and self.metadata['plots']:

lazy_load_signals = False
if self.lazy:
Expand Down
7 changes: 7 additions & 0 deletions neurotic/tests/metadata-for-tests.yml
@@ -1,6 +1,13 @@
neurotic_config:
remote_data_root: https://gin.g-node.org/jpgill86/neurotic-data/raw/master/tests

empty-plots:
data_dir: events-and-epochs
remote_data_dir: events-and-epochs
data_file: events_and_epochs.axgx

plots: []

video-jumps-unset:
data_dir: events-and-epochs
remote_data_dir: events-and-epochs
Expand Down
35 changes: 31 additions & 4 deletions neurotic/tests/test_gui.py
Expand Up @@ -19,12 +19,16 @@
class GUITestCase(unittest.TestCase):

def setUp(self):
self.file = pkg_resources.resource_filename(
self.example_file = pkg_resources.resource_filename(
'neurotic', 'example/metadata.yml')
self.test_file = pkg_resources.resource_filename(
'neurotic.tests', 'metadata-for-tests.yml')

# make a copy of the metadata file in a temp directory
# make a copy of the metadata files in a temp directory
self.temp_dir = tempfile.TemporaryDirectory(prefix='neurotic-')
self.temp_file = shutil.copy(self.file, self.temp_dir.name)
self.temp_example_file = shutil.copy(self.example_file,
self.temp_dir.name)
self.temp_test_file = shutil.copy(self.test_file, self.temp_dir.name)

def tearDown(self):
# clean up references to proxy objects which keep files locked
Expand All @@ -40,8 +44,31 @@ def test_mkQApp(self):

def test_example_create_ephyviewer_window(self):
"""Test creating an ephyviewer window for example dataset"""
file = self.temp_example_file
dataset = 'example dataset'
metadata = neurotic.MetadataSelector(file=self.temp_file,
metadata = neurotic.MetadataSelector(file=file,
initial_selection=dataset)
metadata.download_all_data_files()

lazy = False # TODO: get lazy=True case to work
# (tearDown fails due to file lock)
blk = neurotic.load_dataset(metadata=metadata, lazy=lazy)
ephyviewer_config = neurotic.EphyviewerConfigurator(metadata, blk,
lazy=lazy)
ephyviewer_config.show_all()

app = mkQApp()
win = ephyviewer_config.create_ephyviewer_window()
self.assertIsInstance(win, MainViewer)

# close thread properly
win.close()

def test_empty_plots(self):
"""Test ephyviewer window with empty plot list"""
file = self.temp_test_file
dataset = 'empty-plots'
metadata = neurotic.MetadataSelector(file=file,
initial_selection=dataset)
metadata.download_all_data_files()

Expand Down

0 comments on commit 9fd6435

Please sign in to comment.