File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change 6
6
methods (TestClassSetup )
7
7
function setUpAndTearDowns(testCase )
8
8
openAIEnvVar = " OPENAI_KEY" ;
9
- key = getenv(openAIEnvVar );
10
- writelines(" OPENAI_API_KEY=" +key ," .env" );
9
+ secretKey = getenv(openAIEnvVar );
10
+ % Create an empty .env file because it is expected by our .mlx
11
+ % example files
12
+ writelines(" " ," .env" );
13
+
14
+ % Assign the value of the secret key to OPENAI_API_KEY using
15
+ % the test fixture
16
+ import matlab .unittest .fixtures .EnvironmentVariableFixture
17
+ fixture = EnvironmentVariableFixture(" OPENAI_API_KEY" , secretKey );
18
+ testCase .applyFixture(fixture );
11
19
12
- testCase .addTeardown(@() delete(" .env" ));
13
- testCase .addTeardown(@() unsetenv(" OPENAI_API_KEY" ));
14
20
testCase .addTeardown(@() iCloseAll());
15
21
end
16
22
end
You can’t perform that action at this time.
0 commit comments