-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BBPBGLIB-1097] Reorganization of unit/integration tests (#83)
## Context This PR addresses a long-standing issue of internal tests all being mixed (apart from scientific ones). It meant that tests which required more dependencies needed a special annotation so that they wouldn't run in the CI job for unit tests. It also meant that the list of loaded modules for these system tests was hardcoded, and in particular the NGV test had a pretty elaborated hack around that. ## Scope We finally segregate the tests according to their nature and dependencies, and created the main test dirs: - tests/unit - tests/integration - tests/integration-e2e - tests/scientific - tests/scientific-ngv With more groups it is also possible to trivially run tests in parallel, and therefore we dropped pytest-xdist. Unit tests notably have very little dependencies, even creating and exposing a NEURON mock for the individual tests. Also note that `integration-e2e` contain tests that actually run end-to-end simulations and may rely on blue brain models. However it's strongly encouraged future integration tests to only rely on NEURON, which can be placed in `integration` tests. This PR - Moved the tests to their respective group - Adapted tests so they don't have any special annotations - Adapted testing system and CI, using three TOX groups: - unit - integration - bbp-model - Updated contribution docs ## Review * [x] PR description is complete * [x] Coding style (imports, function length, New functions, classes or files) are good * [x] Updated Readme, in-code, developer documentation
- Loading branch information
1 parent
b7f4b25
commit 614bec7
Showing
54 changed files
with
332 additions
and
387 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,11 @@ fi | |
|
||
# Get the common synapses | ||
COMMON_DIR=_common | ||
git clone [email protected]:hpc/sim/models/common.git $COMMON_DIR --depth=1 | ||
if [ -d "$COMMON_DIR" ]; then | ||
( cd "$COMMON_DIR" && git pull --quiet ) | ||
else | ||
git clone [email protected]:hpc/sim/models/common.git $COMMON_DIR --depth=1 | ||
fi | ||
|
||
MOD_BUILD_DIR="mods.tmp" | ||
mkdir -p $MOD_BUILD_DIR | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import os | ||
import pytest | ||
|
||
assert os.environ.get("NEURODAMUS_NEOCORTEX_ROOT"), "Test requires loading a neocortex model to run" | ||
|
||
pytestmark = [ | ||
pytest.mark.forked, | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 1 addition & 5 deletions
6
tests/test_connection.py → tests/integration-e2e/test_connection.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
def test_dry_run_workflow(USECASE3): | ||
""" | ||
Test that the dry run mode works | ||
""" | ||
|
||
from neurodamus import Neurodamus | ||
nd = Neurodamus( | ||
str(USECASE3 / "simulation_sonata.json"), | ||
dry_run=True | ||
) | ||
|
||
nd.run() | ||
|
||
assert 20.0 <= nd._dry_run_stats.cell_memory_total <= 30.0 | ||
assert 0.0 <= nd._dry_run_stats.synapse_memory_total <= 1.0 | ||
assert 80.0 <= nd._dry_run_stats.base_memory <= 120.0 | ||
expected_items = { | ||
'L4_PC-dSTUT': 2, | ||
'L4_MC-dSTUT': 1, | ||
'L4_MC-dNAC': 1, | ||
'L5_PC-dSTUT': 1 | ||
} | ||
assert nd._dry_run_stats.metype_counts == expected_items | ||
assert nd._dry_run_stats.suggest_nodes(0.3) > 0 |
17 changes: 2 additions & 15 deletions
17
tests/test_error_handling.py → tests/integration-e2e/test_error_handling.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.