Skip to content

Commit

Permalink
Merge pull request #434 from NeuroML/fix-pynml-archive
Browse files Browse the repository at this point in the history
Fix pynml archive
  • Loading branch information
sanjayankur31 authored Nov 5, 2024
2 parents 581d1a4 + 17c71be commit 1a909ba
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
10 changes: 5 additions & 5 deletions pyneuroml/archive/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
import typing
from zipfile import ZipFile

from pyneuroml.utils import get_model_file_list
from pyneuroml.utils.cli import build_namespace
from pyneuroml.runners import run_jneuroml
from pyneuroml.sedml import validate_sedml_files
from pyneuroml.utils import get_model_file_list
from pyneuroml.utils.cli import build_namespace

logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
Expand Down Expand Up @@ -88,7 +88,7 @@ def cli(a: typing.Optional[typing.Any] = None, **kwargs: str):
a = build_namespace(DEFAULTS, a, **kwargs)

rootfile = a.rootfile
zipfile_extension = None
zipfile_extension = ".neux.zip"

# first generate SED-ML file
# use .omex as extension
Expand All @@ -99,7 +99,7 @@ def cli(a: typing.Optional[typing.Any] = None, **kwargs: str):
run_jneuroml("", a.rootfile, "-sedml")

rootfile = a.rootfile.replace(".xml", ".sedml")
zipfile_extension = ".omex"
zipfile_extension = ".omex.zip"

# validate the generated file
validate_sedml_files([rootfile])
Expand All @@ -119,7 +119,7 @@ def cli(a: typing.Optional[typing.Any] = None, **kwargs: str):
def create_combine_archive(
rootfile: str,
zipfile_name: typing.Optional[str] = None,
zipfile_extension=".neux",
zipfile_extension=".neux.zip",
filelist: typing.List[str] = [],
extra_files: typing.List[str] = [],
):
Expand Down
7 changes: 3 additions & 4 deletions tests/archive/test_archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
Copyright 2023 NeuroML contributors
"""


import logging
import pathlib
import unittest
Expand Down Expand Up @@ -109,7 +108,7 @@ def test_create_combine_archive(self):
rootfile=dirname + "/HH_example_cell.nml",
filelist=filelist,
)
self.assertTrue(pathlib.Path(dirname + "/HH_example.neux").exists())
self.assertTrue(pathlib.Path(dirname + "/HH_example.neux.zip").exists())

dirname = str(thispath.parent.parent.parent)
filelist = []
Expand All @@ -119,7 +118,7 @@ def test_create_combine_archive(self):
filelist=filelist,
)
self.assertTrue(
pathlib.Path(dirname + "/examples/LEMS_NML2_Ex5_DetCell.neux").exists()
pathlib.Path(dirname + "/examples/LEMS_NML2_Ex5_DetCell.neux.zip").exists()
)

dirname = str(thispath.parent.parent.parent)
Expand All @@ -130,5 +129,5 @@ def test_create_combine_archive(self):
filelist=filelist,
)
self.assertTrue(
pathlib.Path(dirname + "/examples/NML2_SingleCompHHCell.neux").exists()
pathlib.Path(dirname + "/examples/NML2_SingleCompHHCell.neux.zip").exists()
)

0 comments on commit 1a909ba

Please sign in to comment.