Skip to content

Commit

Permalink
Merge pull request #91 from dbpunk-labs/90-unable-to-download-llama
Browse files Browse the repository at this point in the history
add matrix test environment
  • Loading branch information
imotai authored Sep 30, 2023
2 parents 027d670 + 2d248d8 commit 722f014
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Python Project
name: backend testing

on:
push:
Expand Down
36 changes: 36 additions & 0 deletions .github/workflows/cli_ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Cli Testing

on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.10", "3.11"]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: recursive
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: pip install -r requirements.txt
- name: Run cli tests
shell: bash
run: |
cd up
pip install .
pytest tests/*.py
cd ../chat
pip install .
pytest tests/*.py
19 changes: 19 additions & 0 deletions chat/tests/test_parse_files.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#! /usr/bin/env python3
# vim:fenc=utf-8
#
# Copyright © 2023 imotai <imotai@imotai-ub>
#
# Distributed under terms of the MIT license.

"""
"""

from og_terminal.utils import parse_file_path


def test_parse_file_path():
prompt = "convert the file /up /home/test.pdf to text"
paths = parse_file_path(prompt)
assert len(paths) == 1, "bad file path count"
assert paths[0] == '/home/test.pdf', "bad file path "
1 change: 0 additions & 1 deletion start_sandbox.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#! /bin/sh
#
# start_local.sh
ps -ef | grep python3 | grep -v grep | awk '{print $2}' | while read line; do kill -9 $line; done
WORKDIR=`pwd`
Expand Down
3 changes: 2 additions & 1 deletion up/src/og_up/up.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ def run_with_realtime_print(
shell=useshell,
env=env,
)
text_fd = io.TextIOWrapper(p.stdout, encoding="utf-8", newline=os.linesep)

text_fd = io.TextIOWrapper(p.stdout, encoding="utf-8", newline=os.linesep, errors='replace')
while True:
chunk = text_fd.read(40)
if not chunk:
Expand Down
25 changes: 25 additions & 0 deletions up/tests/up_tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#! /usr/bin/env python3
# vim:fenc=utf-8
#
# Copyright © 2023 imotai <imotai@imotai-ub>
#
# Distributed under terms of the MIT license.

"""
"""

import os
from og_up.up import run_with_realtime_print

import pytest

def test_run_print():
use_dir = os.path.expanduser("~")
command = ["ls", use_dir]
result_code = 0
for code , output in run_with_realtime_print(command):
result_code = code
assert code == 0, "bad return code"



0 comments on commit 722f014

Please sign in to comment.