Skip to content

fix: use separate gptscript file for cred override on Windows #39

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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