Skip to content

Commit

Permalink
Add Tutorial Tests (#450)
Browse files Browse the repository at this point in the history
* remove unused ophys script

* Remove toolbox dependencies from ecephys tutorial

- Not useful for someone who doesn't have the statistics toolbox
- A lot more work to get working with CI.

* Revert "Revert "Add tutorial tests""

This reverts commit 5a516d0.

* Revert "Revert "Remove code blocks from dynamic filters tutorial""

This reverts commit 322a225.

* Revert "Revert "Update reformatted dynamic filters html""

This reverts commit e8587e7.

* Fix tutorial tests missing environment files

We need to generateCore here.

* reinstate dynamic filter live script.

* Add path before running scripts

Otherwise running the scripts may not properly handle the environment correctly.

* print debugging

* remove formatStruct which is not a tutorial

Co-authored-by: Lawrence Niu <[email protected]>
  • Loading branch information
lawrence-mbf and lawrence-mbf authored Jul 29, 2022
1 parent 5a516d0 commit 5409664
Show file tree
Hide file tree
Showing 6 changed files with 300 additions and 240 deletions.
31 changes: 31 additions & 0 deletions +tests/+unit/tutorialTest.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
function tests = tutorialTest()
tests = functiontests(localfunctions);
end

function setupOnce(testCase)
rootPath = fullfile(fileparts(mfilename('fullpath')), '..', '..');
testCase.applyFixture(matlab.unittest.fixtures.PathFixture(rootPath));
tutorialPath = fullfile(rootPath, 'tutorials');
addpath(tutorialPath);
testCase.TestData.listing = dir(tutorialPath);
end

function setup(testCase)
testCase.applyFixture(matlab.unittest.fixtures.WorkingFolderFixture);
generateCore('savedir', '.');
rehash();
end

function testTutorials(testCase)
skippedTutorials = {...
'basicUsage.mlx', ...
'convertTrials.m', ...
'formatStruct.m'};
for i = 1:length(testCase.TestData.listing)
listing = testCase.TestData.listing(i);
if listing.isdir || any(strcmp(skippedTutorials, listing.name))
continue;
end
run(listing.name);
end
end
Binary file modified tutorials/dynamically_loaded_filters.mlx
Binary file not shown.
Binary file modified tutorials/ecephys.mlx
Binary file not shown.
37 changes: 17 additions & 20 deletions tutorials/html/dynamically_loaded_filters.html

Large diffs are not rendered by default.

266 changes: 252 additions & 14 deletions tutorials/html/ecephys.html

Large diffs are not rendered by default.

206 changes: 0 additions & 206 deletions tutorials/ophys.m

This file was deleted.

0 comments on commit 5409664

Please sign in to comment.