Skip to content

Commit

Permalink
Fix unit tests (#119)
Browse files Browse the repository at this point in the history
## Context
PR #115 has set checks on the command arguments so that positional
arguments will be rejected. One of the unit test wasn't using the right
`$NEURODAMUS_PYTHON/init.py` during the PR and thus failing now.
And towards Python 3.12, `pkg_resources` will be deprecated and needs to
be replaced.

## Scope
This PR fixes the unit test in `test_cli_opts.py` by correcting the
argument to be "--save=PATH".
And it replaces `pkg_resources.get_distribution` with
`importlib.metadata.version`

## Testing
Existing tests

## Review
* [x] PR description is complete
* [x] Coding style (imports, function length, New functions, classes or
files) are good
* [x] Unit/Scientific test added
* [ ] Updated Readme, in-code, developer documentation
  • Loading branch information
WeinaJi authored Feb 5, 2024
1 parent 0e309f3 commit 189f905
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions neurodamus/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
`node`, `cell_distributor`, etc; and still depends on several low-level HOC files at runtime.
"""
from __future__ import absolute_import
import pkg_resources
import importlib.metadata
try:
__version__ = pkg_resources.get_distribution(__name__).version
__version__ = importlib.metadata.version(__name__)
except Exception:
__version__ = 'devel'

Expand Down
2 changes: 1 addition & 1 deletion tests/integration-e2e/test_cli_opts.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def test_save_restore_cli():
checkpoint_dir = test_folder_path / "output-save" / "checkpoint"

command = ["neurodamus", test_folder_path / CONFIG_FILE_MINI,
"--" + action, checkpoint_dir]
"--" + action + "=" + str(checkpoint_dir)]
# Save-Restore raises exception when using NEURON
if simulator == "NEURON":
with pytest.raises(subprocess.CalledProcessError):
Expand Down

0 comments on commit 189f905

Please sign in to comment.