Skip to content

Commit

Permalink
Merge pull request #39 from thedadams/fix-cred-override-windows
Browse files Browse the repository at this point in the history
fix: use separate gptscript file for cred override on Windows
  • Loading branch information
thedadams authored Jul 22, 2024
2 parents 2182e11 + 146c9dc commit e20cb80
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 5 additions & 0 deletions tests/fixtures/credential-override-windows.gpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
credentials: github.com/gptscript-ai/credential as test.ts.credential_override with TEST_CRED as env

#!/usr/bin/env powershell.exe

echo "$env:TEST_CRED"
7 changes: 5 additions & 2 deletions tests/test_gptscript.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def complex_tool():
@pytest.fixture
def tool_list():
shebang = "#!/bin/bash"
if platform.system() == "windows":
if platform.system().lower() == "windows":
shebang = "#!/usr/bin/env powershell.exe"
return [
ToolDef(tools=["echo"], instructions="echo 'hello there'"),
Expand Down Expand Up @@ -185,8 +185,11 @@ async def collect_events(run: Run, e: CallFrame | RunFrame | PromptFrame):

@pytest.mark.asyncio
async def test_credential_override(gptscript):
gptscriptFile = "credential-override.gpt"
if platform.system().lower() == "windows":
gptscriptFile = "credential-override-windows.gpt"
run = gptscript.run(
os.getcwd() + "/tests/fixtures/credential-override.gpt",
f"{os.getcwd()}{os.sep}tests{os.sep}fixtures{os.sep}{gptscriptFile}",
Options(
disableCache=True,
credentialOverrides=['test.ts.credential_override:TEST_CRED=foo']
Expand Down

0 comments on commit e20cb80

Please sign in to comment.