Skip to content

Commit 50810ac

Browse files
committed
More test fixes
Tutorial 9 was set to unitS instead of unit. Added network information switch to mitigate failiure Remove .asv files Former-commit-id: 44357d9
1 parent e9cf96e commit 50810ac

File tree

6 files changed

+21
-141
lines changed

6 files changed

+21
-141
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,5 @@ _pdf
1212

1313
*.sublime-workspace
1414
*.tap
15+
16+
*.asv

test/spinwFunctionTests.asv

Lines changed: 0 additions & 136 deletions
This file was deleted.

test/spinwFunctionTests.m

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,13 @@
1818
dir(fullfile(sw_rootdir, 'tutorials', 'publish', 'tutorial*.m')),...
1919
'UniformOutput', false);
2020
% Incase we need to debug one tutorial.
21-
% testFun = {fullfile(sw_rootdir, 'tutorials', 'publish', 'tutorial38.m')};
21+
% testFun = {fullfile(sw_rootdir, 'tutorials', 'publish', 'tutorial9.m')};
2222

2323
end
2424

2525
methods (TestMethodSetup)
2626
function prepareForRun(testCase)
27+
2728
close all
2829
clc
2930

@@ -68,11 +69,24 @@ function testFunction(testCase, testFun)
6869
break
6970
end
7071
try
71-
dat = webread(strtok(url,''')'));
72+
[~] = webread(strtok(url,''')'));
7273
catch ME
73-
warning('WARNING! Remote content not found for tutorial %s', testFun);
74+
ident = '';
75+
switch ME.identifier
76+
case 'MATLAB:webservices:HTTP404StatusCodeError'
77+
warning('WARNING! Remote content not found for tutorial %s', testFun);
78+
ident = 'MATLAB:webservices:HTTP404StatusCodeError';
79+
case 'MATLAB:webservices:UnknownHost'
80+
warning('WARNING! Can not find remote content. DNS problem?')
81+
ident = 'MATLAB:webservices:UnknownHost';
82+
case 'MATLAB:webservices:Timeout'
83+
warning('WARNING! Can not connect to the internet.')
84+
ident = 'MATLAB:webservices:Timeout';
85+
otherwise
86+
rethrow(ME)
87+
end
7488
import matlab.unittest.constraints.Matches
75-
% testCase.verifyMatches(ME.identifier, 'MATLAB:webservices:HTTP404StatusCodeError');
89+
testCase.verifyMatches(ME.identifier, ident);
7690
return
7791
end
7892
end
-22 KB
Binary file not shown.
-2.34 KB
Binary file not shown.

tutorials/publish/tutorial9.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
% previously given spin quantum number in the spinw.addatom method.
3939

4040
S0 = [1 -2 1; 2 -1 -1; 0 0 0];
41-
DMkag.genmagstr('mode','direct','k',[0 0 0],'n',[0 0 1],'unitS','lu', 'S',S0);
41+
DMkag.genmagstr('mode','direct','k',[0 0 0],'n',[0 0 1],'unit','lu', 'S',S0);
4242
DMkag.energy
4343

4444
plot(DMkag,'range',[3 3 1/2])

0 commit comments

Comments
 (0)