(fix) test - moved to circe ci dockerfile

This commit is contained in:
ishaan-jaff 2024-01-10 21:54:00 +05:30
parent 954d1b071c
commit 1ff9785c6b

View file

@ -1,73 +1,73 @@
import sys, os, time # import sys, os, time
import traceback # import traceback
from dotenv import load_dotenv # from dotenv import load_dotenv
load_dotenv() # load_dotenv()
import os, io # import os, io
# this file is to test litellm/proxy # # this file is to test litellm/proxy
sys.path.insert( # sys.path.insert(
0, os.path.abspath("../..") # 0, os.path.abspath("../..")
) # Adds the parent directory to the system path # ) # Adds the parent directory to the system path
import pytest, logging # import pytest, logging
import litellm # import litellm
from litellm import embedding, completion, completion_cost, Timeout # from litellm import embedding, completion, completion_cost, Timeout
from litellm import RateLimitError # from litellm import RateLimitError
import sys, os, time # import sys, os, time
import traceback # import traceback
from dotenv import load_dotenv # from dotenv import load_dotenv
load_dotenv() # load_dotenv()
import os, io # import os, io
# this file is to test litellm/proxy # # this file is to test litellm/proxy
from concurrent.futures import ThreadPoolExecutor # from concurrent.futures import ThreadPoolExecutor
sys.path.insert( # sys.path.insert(
0, os.path.abspath("../..") # 0, os.path.abspath("../..")
) # Adds the parent directory to the system path # ) # Adds the parent directory to the system path
import pytest, logging, requests # import pytest, logging, requests
import litellm # import litellm
from litellm import embedding, completion, completion_cost, Timeout # from litellm import embedding, completion, completion_cost, Timeout
from litellm import RateLimitError # from litellm import RateLimitError
from github import Github # from github import Github
import subprocess # import subprocess
# Function to execute a command and return the output # # Function to execute a command and return the output
def run_command(command): # def run_command(command):
process = subprocess.Popen(command, stdout=subprocess.PIPE, shell=True) # process = subprocess.Popen(command, stdout=subprocess.PIPE, shell=True)
output, _ = process.communicate() # output, _ = process.communicate()
return output.decode().strip() # return output.decode().strip()
# Retrieve the current branch name # # Retrieve the current branch name
branch_name = run_command("git rev-parse --abbrev-ref HEAD") # branch_name = run_command("git rev-parse --abbrev-ref HEAD")
# GitHub personal access token (with repo scope) or use username and password # # GitHub personal access token (with repo scope) or use username and password
access_token = os.getenv("GITHUB_ACCESS_TOKEN") # access_token = os.getenv("GITHUB_ACCESS_TOKEN")
# Instantiate the PyGithub library's Github object # # Instantiate the PyGithub library's Github object
g = Github(access_token) # g = Github(access_token)
# Provide the owner and name of the repository where the pull request is located # # Provide the owner and name of the repository where the pull request is located
repository_owner = "BerriAI" # repository_owner = "BerriAI"
repository_name = "litellm" # repository_name = "litellm"
# Get the repository object # # Get the repository object
repo = g.get_repo(f"{repository_owner}/{repository_name}") # repo = g.get_repo(f"{repository_owner}/{repository_name}")
# Iterate through the pull requests to find the one related to your branch # # Iterate through the pull requests to find the one related to your branch
for pr in repo.get_pulls(): # for pr in repo.get_pulls():
print(f"in here! {pr.head.ref}") # print(f"in here! {pr.head.ref}")
if pr.head.ref == branch_name: # if pr.head.ref == branch_name:
pr_number = pr.number # pr_number = pr.number
break # break
print(f"The pull request number for branch {branch_name} is: {pr_number}") # print(f"The pull request number for branch {branch_name} is: {pr_number}")
# def test_add_new_key(): # def test_add_new_key():