Skip to content

Commit 3e8cd9e

Browse files
Merge pull request #23 from ibuildthecloud/main
bug: don't match archive with glob
2 parents 97a47fa + 7202cd5 commit 3e8cd9e

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

gptscript/install.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ def install():
150150

151151
# Find the extracted binary and rename/move it to the versioned name in the python bin directory
152152
extracted_binary_path = next(
153-
output_dir.glob(gptscript_binary_name + "*"), None
153+
output_dir.glob(gptscript_binary_name), None
154154
) # Adjust the glob pattern if necessary
155155
if extracted_binary_path:
156156
shutil.move(str(extracted_binary_path), str(versioned_binary_path))

tests/test_gptscript.py

+13-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import os
22
import platform
3+
import subprocess
34

45
import pytest
56

67
from gptscript.confirm import AuthResponse
78
from gptscript.frame import RunEventType, CallFrame, RunFrame, RunState, PromptFrame
89
from gptscript.gptscript import GPTScript
10+
from gptscript.install import install, gptscript_binary_name, python_bin_dir
911
from gptscript.opts import GlobalOptions, Options
1012
from gptscript.prompt import PromptResponse
1113
from gptscript.run import Run
@@ -77,6 +79,13 @@ def tool_list():
7779
]
7880

7981

82+
def test_install():
83+
install()
84+
bin_name = str(python_bin_dir / gptscript_binary_name)
85+
process = subprocess.Popen([bin_name, '-v'], stdout=subprocess.PIPE, text=True)
86+
assert process.stdout.read().startswith('gptscript version ')
87+
88+
8089
@pytest.mark.asyncio
8190
async def test_create_another_gptscript():
8291
g = GPTScript()
@@ -420,15 +429,16 @@ async def process_event(r: Run, frame: CallFrame | RunFrame | PromptFrame):
420429
for output in frame.output:
421430
event_content += output.content
422431

423-
tool = ToolDef(tools=["sys.exec"], instructions="List the files in the current directory.")
432+
tool = ToolDef(tools=["sys.exec"], instructions="List the files in the current directory. If that doesn't work"
433+
"print the word FAIL.")
424434
out = await gptscript.evaluate(tool,
425435
Options(confirm=True, disableCache=True),
426436
event_handlers=[process_event],
427437
).text()
428438

429439
assert confirm_event_found, "No confirm event"
430-
assert "authorization error" in out, "Unexpected output: " + out
431-
assert "authorization error" in event_content, "Unexpected event output: " + event_content
440+
assert "FAIL" in out, "Unexpected output: " + out
441+
assert "FAIL" in event_content, "Unexpected event output: " + event_content
432442

433443

434444
@pytest.mark.asyncio

0 commit comments

Comments
 (0)