Skip to content

Commit

Permalink
Temp file as config in test_config_error
Browse files Browse the repository at this point in the history
  • Loading branch information
atemerev committed Feb 12, 2024
1 parent 97ac38a commit 686d7ee
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 98 deletions.
4 changes: 2 additions & 2 deletions neurodamus/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import re
from enum import Enum
from .core import NeurodamusCore as Nd
from .core.configuration import GlobalConfig, SimConfig
from .core.configuration import GlobalConfig, SimConfig, ConfigurationError
from .utils import compat
from .utils.logging import log_all
from .utils.pyutils import append_recarray
Expand Down Expand Up @@ -560,7 +560,7 @@ def _update_conductance_ratio(self, syn_obj, is_inhibitory, value):
def _configure(self, synapses, configuration):
res = self.ConnUtils.executeConfigure(synapses, configuration)
if res > 0:
raise ValueError(f"Errors found in configuration: {configuration}")
raise ConfigurationError(f"Errors found in configuration: {configuration}")

def _configure_cell(self, cell):
""" Internal helper to apply all the configuration statements on
Expand Down
20 changes: 8 additions & 12 deletions tests/integration-e2e/test_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import os
import pytest
from pathlib import Path

from neurodamus.core.configuration import ConfigurationError
from neurodamus.io.synapse_reader import SynapseParameters
from neurodamus.node import Node
from tempfile import NamedTemporaryFile
Expand All @@ -14,11 +16,10 @@
def sonata_config_file_err(sonata_config):
extra_config = {"connection_overrides": [
{
"name": "scheme_CaUse_ee_ERR",
"source": "Excitatory",
"target": "Excitatory",
"weight": 1.0,
"synapse_configure": "%s.dummy=1 cao_CR_GluSynapse = 1.2 %s.Use_d *= 0.158401372855"
"name": "config_ERR",
"source": "nodesPopB",
"target": "nodesPopB",
"synapse_configure": "%s.dummy=1"
}
]}

Expand Down Expand Up @@ -53,15 +54,10 @@ def test_add_synapses():

@pytest.mark.slow
def test_config_error(sonata_config_file_err):
with pytest.raises(ValueError):
n = Node(str(sonata_config_file_err))
with pytest.raises(ConfigurationError):
n = Node(str(sonata_config_file_err.name))
n.load_targets()
n.create_cells()
n.create_synapses()
syn_manager = n.circuits.get_edge_manager("default", "default")
conn = list(syn_manager.get_connections(62798))[0]
new_params = SynapseParameters.create_array(1)
new_params[0].sgid = conn.sgid
conn.add_synapses(n._target_manager, new_params)
for syn_manager in n._circuits.all_synapse_managers():
syn_manager.finalize(0, False)
84 changes: 0 additions & 84 deletions tests/simulations/v5_sonata/simulation_config_err.json

This file was deleted.

0 comments on commit 686d7ee

Please sign in to comment.