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 66 methods (TestClassSetup )
77 function setUpAndTearDowns(testCase )
88 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 );
1119
12- testCase .addTeardown(@() delete(" .env" ));
13- testCase .addTeardown(@() unsetenv(" OPENAI_API_KEY" ));
1420 testCase .addTeardown(@() iCloseAll());
1521 end
1622 end
You can’t perform that action at this time.
0 commit comments