Skip to content

Commit

Permalink
don't copy circuit data iin test_cli_opts.py
Browse files Browse the repository at this point in the history
  • Loading branch information
WeinaJi committed Oct 3, 2024
1 parent 9998205 commit dea058f
Showing 1 changed file with 20 additions and 24 deletions.
44 changes: 20 additions & 24 deletions tests/integration-e2e/test_cli_opts.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import os
from pathlib import Path
import pytest
import shutil
import subprocess
import tempfile

Expand All @@ -20,13 +19,11 @@ def test_save_restore_cli():
for simulator in ("NEURON", "CORENEURON"):
test_folder = tempfile.TemporaryDirectory("cli-test-" + simulator) # auto removed
test_folder_path = Path(test_folder.name)
# Copy local data
shutil.copytree(SIM_DIR / CIRCUIT_DIR, test_folder_path / CIRCUIT_DIR)

for action, tstop in (("save", 100), ("restore", 200)):
sim_config_data["target_simulator"] = simulator
sim_config_data["run"]["tstop"] = tstop
sim_config_data["output"]["output_dir"] = str(test_folder_path / ("output-" + action))
sim_config_data["network"] = str(SIM_DIR / CIRCUIT_DIR / "circuit_config.json")

with open(test_folder_path / CONFIG_FILE_MINI, "w") as f:
json.dump(sim_config_data, f, indent=2)
Expand All @@ -48,9 +45,11 @@ def test_cli_prcellgid():
from neurodamus import Neurodamus
test_folder = tempfile.TemporaryDirectory("cli-test-prcellgid") # auto removed
test_folder_path = Path(test_folder.name)
# Copy local data
shutil.copy(SIM_DIR / "simulation_config_mini.json", test_folder_path)
shutil.copytree(SIM_DIR / CIRCUIT_DIR, test_folder_path / CIRCUIT_DIR)
with open(SIM_DIR / CONFIG_FILE_MINI, "r") as f:
sim_config_data = json.load(f)
sim_config_data["network"] = str(SIM_DIR / CIRCUIT_DIR / "circuit_config.json")
with open(test_folder_path / CONFIG_FILE_MINI, "w") as f:
json.dump(sim_config_data, f, indent=2)

os.chdir(test_folder_path)
nd = Neurodamus(CONFIG_FILE_MINI, dump_cell_state=1)
Expand All @@ -62,12 +61,11 @@ def test_cli_prcellgid():
def test_cli_disable_reports():
test_folder = tempfile.TemporaryDirectory("cli-test-disable-reports") # auto removed
test_folder_path = Path(test_folder.name)
# Copy local data
shutil.copy(SIM_DIR / "simulation_config_mini.json", test_folder_path)
shutil.copytree(SIM_DIR / CIRCUIT_DIR, test_folder_path / CIRCUIT_DIR)

with open(SIM_DIR / CONFIG_FILE_MINI, "r") as f:
sim_config_data = json.load(f)
sim_config_data["network"] = str(SIM_DIR / CIRCUIT_DIR / "circuit_config.json")
with open(test_folder_path / CONFIG_FILE_MINI, "w") as f:
json.dump(sim_config_data, f, indent=2)

subprocess.run(
["neurodamus", CONFIG_FILE_MINI, "--disable-reports"],
Expand Down Expand Up @@ -99,11 +97,10 @@ def test_cli_keep_build():
sim_config_data = json.load(f)
sim_config_data["target_simulator"] = "CORENEURON"
sim_config_data["output"]["output_dir"] = "output_keep_build"
sim_config_data["network"] = str(SIM_DIR / CIRCUIT_DIR / "circuit_config.json")

test_folder = tempfile.TemporaryDirectory("cli-test-keep-build") # auto removed
test_folder_path = Path(test_folder.name)
# Copy local data
shutil.copytree(SIM_DIR / CIRCUIT_DIR, test_folder_path / CIRCUIT_DIR)
with open(test_folder_path / CONFIG_FILE_MINI, "w") as f:
json.dump(sim_config_data, f, indent=2)

Expand All @@ -118,11 +115,10 @@ def test_cli_build_model():
with open(SIM_DIR / CONFIG_FILE_MINI, "r") as f:
sim_config_data = json.load(f)
sim_config_data["target_simulator"] = "CORENEURON"
sim_config_data["network"] = str(SIM_DIR / CIRCUIT_DIR / "circuit_config.json")

test_folder = tempfile.TemporaryDirectory("cli-test-build-model") # auto removed
test_folder_path = Path(test_folder.name)
# Copy local data
shutil.copytree(SIM_DIR / CIRCUIT_DIR, test_folder_path / CIRCUIT_DIR)
with open(test_folder_path / CONFIG_FILE_MINI, "w") as f:
json.dump(sim_config_data, f, indent=2)

Expand Down Expand Up @@ -163,11 +159,10 @@ def test_cli_shm_transfer():
with open(SIM_DIR / CONFIG_FILE_MINI, "r") as f:
sim_config_data = json.load(f)
sim_config_data["target_simulator"] = "CORENEURON"
sim_config_data["network"] = str(SIM_DIR / CIRCUIT_DIR / "circuit_config.json")

test_folder = tempfile.TemporaryDirectory("cli-test-shm-transfer") # auto removed
test_folder_path = Path(test_folder.name)
# Copy local data
shutil.copytree(SIM_DIR / CIRCUIT_DIR, test_folder_path / CIRCUIT_DIR)
with open(test_folder_path / CONFIG_FILE_MINI, "w") as f:
json.dump(sim_config_data, f, indent=2)

Expand Down Expand Up @@ -196,9 +191,11 @@ def test_cli_shm_transfer():
def test_cli_lb_mode():
test_folder = tempfile.TemporaryDirectory("cli-test-lb-mode") # auto removed
test_folder_path = Path(test_folder.name)
# Copy local data
shutil.copy(SIM_DIR / "simulation_config_mini.json", test_folder_path)
shutil.copytree(SIM_DIR / CIRCUIT_DIR, test_folder_path / CIRCUIT_DIR)
with open(SIM_DIR / CONFIG_FILE_MINI, "r") as f:
sim_config_data = json.load(f)
sim_config_data["network"] = str(SIM_DIR / CIRCUIT_DIR / "circuit_config.json")
with open(test_folder_path / CONFIG_FILE_MINI, "w") as f:
json.dump(sim_config_data, f, indent=2)

for lb_mode in ("WholeCell", "MultiSplit"):
result = subprocess.run(
Expand All @@ -217,12 +214,11 @@ def test_cli_output_path():
from neurodamus import Neurodamus
test_folder = tempfile.TemporaryDirectory("cli-test-output-path") # auto removed
test_folder_path = Path(test_folder.name)
# Copy local data
shutil.copy(SIM_DIR / "simulation_config_mini.json", test_folder_path)
shutil.copytree(SIM_DIR / CIRCUIT_DIR, test_folder_path / CIRCUIT_DIR)

with open(SIM_DIR / CONFIG_FILE_MINI, "r") as f:
sim_config_data = json.load(f)
sim_config_data["network"] = str(SIM_DIR / CIRCUIT_DIR / "circuit_config.json")
with open(test_folder_path / CONFIG_FILE_MINI, "w") as f:
json.dump(sim_config_data, f, indent=2)

simconfig_output_path = sim_config_data["output"]["output_dir"]
output_path = "new_output"
Expand Down

0 comments on commit dea058f

Please sign in to comment.