Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
sbairagy-MW authored Apr 26, 2021
1 parent 1f3ba6c commit f0aa293
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions test/tools/DownloadDeeplabV3PlusFixture.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
classdef DownloadDeeplabV3PlusFixture < matlab.unittest.fixtures.Fixture
% DownloadDeeplabFixture A fixture for calling downloadPretrainedDeepLabV3Plus if
% necessary. This is to ensure that this function is only called once
% and only when tests need it. It also provides a teardown to return
% the test environment to the expected state before testing.

% Copyright 2021 The MathWorks, Inc

properties(Constant)
DeeplabV3DataDir = fullfile(getRepoRoot(),'model')
end

properties
DeeplabV3Exist (1,1) logical
end

methods
function setup(this)
this.DeeplabV3Exist = exist(fullfile(this.DeeplabV3DataDir,'deepLabV3Plus-voc.mat'),'file')==2;

% Call this in eval to capture and drop any standard output
% that we don't want polluting the test logs.
if ~this.DeeplabV3Exist
evalc('helper.downloadPretrainedDeepLabv3Plus();');
end
end

function teardown(this)
if this.DeeplabV3Exist
delete(fullfile(this.DeeplabV3DataDir,'deepLabV3Plus-voc.mat'));
end
end
end
end

0 comments on commit f0aa293

Please sign in to comment.