Skip to content

Conversation

@laurator
Copy link
Contributor

@laurator laurator commented Oct 28, 2025

Description

Added pytest test suite for LFP developing brain functionality

Changes

  • Added test_LFP.py to test examples/LFP_developing_brain/LFP_developing_brain.py
  • Updated GitHub Actions workflow to install from requirements.txt and run the tests automatically
  • Added pytest to requirements.txt for testing dependencies
  • Downloaded files in GitHub Actions workflows are cached to run the tests faster
  • Timer tool added

Testing

  • To run locally: pip install -r requirements.txt and pip install . in the /ncpi folder.
  • All tests of the repository can be run with pytest -v. All files called test_*.py will be searched and run.
  • Specific tests can be run with pytest test_LFP.py. Using python test_LFP.py as an alternative to run a specific script is also possible. In case the tests are run with python test_LFP.py, the last 5 lines of the script have to be uncommented to show the results.
  • GitHub Actions will automatically run tests on push/PR in the main or ncpi-tests branch.

Copy link
Contributor

@AlejandroOrozcoValero AlejandroOrozcoValero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test test_LFP.py gives an error. It looks like it doesn't import the LFP_developing_brain module correctly. I followed the instructions gived in the PR.

Here is the error message I get:

Captura desde 2025-10-29 09-16-22 Captura desde 2025-10-29 09-16-04

The key error is:

NameError: name 'lfp' is not defined

This happens in tests/test_LFP/test_LFP.py at line 53, where it tries to call lfp.load_model_features().

Could you check if there's a missing import statement in the test file?

@laurator
Copy link
Contributor Author

  • Sorry, I forgot to mention that if tests are run locally, installing the local version of the repository is required to make this test work. This is achieved by running pip install . in the /ncpi folder.
  • In case the tests are run with python test_LFP.py, the last 5 lines of the script have to be uncommented to show the results.
  • I've also added a functionality to download the data automatically if tests are run locally.

Copy link
Contributor

@AlejandroOrozcoValero AlejandroOrozcoValero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the implementation! I've tested it and it works correctly. Approving the PR.

@pablomc88 pablomc88 merged commit 4bc46bc into main Oct 30, 2025
2 checks passed
@pablomc88 pablomc88 deleted the ncpi-tests branch October 30, 2025 08:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants