FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
openai-python/scripts/test at main · chenlichao/openai-python · GitHub
chenlichao
/
openai-python
Public
forked from
openai/openai-python
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
openai-python
/
scripts
/
test
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
66 lines (52 loc) · 1.64 KB
Breadcrumbs
openai-python
/
scripts
/
test
Copy path
File metadata and controls
executable file
·
66 lines (52 loc) · 1.64 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!
/usr/bin/env bash
set
-e
cd
"
$(
dirname
"
$0
"
)
/..
"
RED=
'
\033[0;31m
'
GREEN=
'
\033[0;32m
'
YELLOW=
'
\033[0;33m
'
NC=
'
\033[0m
'
#
No Color
function
steady_is_running()
{
curl --silent --fail
"
http://127.0.0.1:4010/_x-steady/health
"
>
/dev/null
2>&1
}
kill_server_on_port
() {
pids=
$(
lsof -t -i tcp:
"
$1
"
||
echo
"
"
)
if
[
"
$pids
"
!=
"
"
]
;
then
kill
"
$pids
"
echo
"
Stopped
$pids
.
"
fi
}
function
is_overriding_api_base_url()
{
[
-n
"
$TEST_API_BASE_URL
"
]
}
if
!
is_overriding_api_base_url
&&
!
steady_is_running
;
then
#
When we exit this script, make sure to kill the background mock server process
trap
'
kill_server_on_port 4010
'
EXIT
#
Start the dev server
./scripts/mock --daemon
fi
if
is_overriding_api_base_url
;
then
echo
-e
"
${GREEN}
✔ Running tests against
${TEST_API_BASE_URL}${NC}
"
echo
elif
!
steady_is_running
;
then
echo
-e
"
${RED}
ERROR:
${NC}
The test suite will not run without a mock Steady server
"
echo
-e
"
running against your OpenAPI spec.
"
echo
echo
-e
"
To run the server, pass in the path or url of your OpenAPI
"
echo
-e
"
spec to the steady command:
"
echo
echo
-e
"
\$
${YELLOW}
./scripts/bootstrap
${NC}
"
echo
-e
"
\$
${YELLOW}
./scripts/mock path/to/your.openapi.yml
${NC}
"
echo
exit
1
else
echo
-e
"
${GREEN}
✔ Mock steady server is running with your OpenAPI spec
${NC}
"
echo
fi
export
DEFER_PYDANTIC_BUILD=false
if
[
"
${OPENAI_TEST_HTTP_CLIENT
:-
httpx}
"
=
"
httpx2
"
]
;
then
echo
"
==> Using HTTPX2 for sync and async API-resource clients (including RESPX-backed cases)
"
fi
echo
"
==> Running tests
"
uv run --locked --all-extras pytest
"
$@
"
echo
"
==> Running Pydantic v1 tests
"
./scripts/test-pydantic-v1
"
$@
"
Back
|
FazBrowse Home
|
New Git URL