Skip to content

Commit

Permalink
Fix euphonic doc test for R2022b and newer
Browse files Browse the repository at this point in the history
  • Loading branch information
mducle committed Aug 28, 2024
1 parent 09a0566 commit 9450140
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 10 deletions.
16 changes: 11 additions & 5 deletions test/EuphonicHelpTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,17 @@ function run_euphonic_doc_tests(testCase)
import matlab.unittest.constraints.IsFalse
txt_fc_noimport = eval_doc('doc euphonic.ForceConstants');
txt_fc_import = eval_doc_import('doc euphonic.ForceConstants');
% Checks both cases called "web" with the "-helpbrowser" argument
testCase.verifySubstring(txt_fc_noimport{2}, 'helpbrowser');
testCase.verifySubstring(txt_fc_import{2}, 'helpbrowser');
% Checks the two text are different
testCase.verifyThat(strcmp(txt_fc_noimport{1}, txt_fc_import{1}), IsFalse);
if verLessThan('matlab', '9.13')
% Checks both cases called "web" with the "-helpbrowser" argument
testCase.verifySubstring(txt_fc_noimport{2}, 'helpbrowser');
testCase.verifySubstring(txt_fc_import{2}, 'helpbrowser');
% Checks the two text are different
testCase.verifyThat(strcmp(txt_fc_noimport{1}, txt_fc_import{1}), IsFalse);
else
% Doc system changed in R2020b does not use the "web" command any more.
testCase.verifySubstring(txt_fc_noimport{1}.Topic, 'ForceConstants');
testCase.verifySubstring(txt_fc_import{2}, 'helpbrowser');
end
% Checks we still have hyperlinks in the imported version
testCase.verifyThat(contains(txt_fc_import{1}, 'href'), IsTrue);
% Checks that __init__ method is included
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
function [docPage, displayText, primitive] = getReferencePage(varargin)
% Function to overload built-in "getReferencePage" function
global web_called_with;
web_called_with = varargin;
displayText = string.empty;
primitive = true;
docPage = [];
end

11 changes: 6 additions & 5 deletions update_module_versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
def get_module_versions():
# gets the required module versions from `min_requirements.txt` file
curdir = os.path.dirname(os.path.abspath(__file__))
req_file = os.path.join(
curdir, 'euphonic_sqw_models', 'min_requirements.txt')
if not os.path.isfile(req_file):
from update_dependencies import update_submodules
update_submodules('euphonic_sqw_models')
for submodule in [['light_python_wrapper', '+light_python_wrapper'],
['euphonic_sqw_models', 'min_requirements.txt']]:
if not os.path.isfile(os.path.join(curdir, *submodule)):
from update_dependencies import update_submodules
update_submodules(submodule[0])
req_file = os.path.join(curdir, 'euphonic_sqw_models', 'min_requirements.txt')
with open(req_file, 'r') as minreq:
reqstrs = minreq.read().splitlines()
reqmods = []
Expand Down

0 comments on commit 9450140

Please sign in to comment.