diff --git a/tests/fixtures/credential-override-windows.gpt b/tests/fixtures/credential-override-windows.gpt new file mode 100644 index 0000000..7e5764c --- /dev/null +++ b/tests/fixtures/credential-override-windows.gpt @@ -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" diff --git a/tests/test_gptscript.py b/tests/test_gptscript.py index c12f719..3ea280d 100644 --- a/tests/test_gptscript.py +++ b/tests/test_gptscript.py @@ -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'"), @@ -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']