FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
cefpython/tools/run_snippets.py at master · pythonthings/cefpython · GitHub
pythonthings
cefpython
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
cefpython
/
tools
/
run_snippets.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
55 lines (47 loc) · 1.65 KB
Breadcrumbs
cefpython
/
tools
/
run_snippets.py
Copy path
File metadata and controls
55 lines (47 loc) · 1.65 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
# Copyright (c) 2018 CEF Python, see the Authors file.
# All rights reserved. Licensed under BSD 3-clause license.
# Project website: https://github.com/cztomczak/cefpython
"""
Run all snippets from the examples/snippets/ directory
and display a summary at the end.
"""
from
common
import
*
import
glob
import
os
import
subprocess
import
sys
def
main
():
# Iterate over all snippets
snippets_iter
=
glob
.
glob
(
os
.
path
.
join
(
SNIPPETS_DIR
,
"*.py"
))
succeeded
=
[]
failed
=
[]
for
snippet
in
snippets_iter
:
print
(
"[run_snippets.py] Running '{snippet}'..."
.
format
(
snippet
=
os
.
path
.
basename
(
snippet
)))
retcode
=
subprocess
.
call
([
sys
.
executable
,
snippet
])
if
retcode
==
0
:
succeeded
.
append
(
os
.
path
.
basename
(
snippet
))
else
:
print
(
"[run_snippets.py] ERROR while running snippet: {snippet}"
.
format
(
snippet
=
snippet
))
failed
.
append
(
os
.
path
.
basename
(
snippet
))
# Print summary
summary
=
""
for
snippet
in
succeeded
:
summary
+=
" OK {snippet}{nl}"
\
.
format
(
snippet
=
snippet
,
nl
=
os
.
linesep
)
for
snippet
in
failed
:
summary
+=
" ERROR {snippet}{nl}"
\
.
format
(
snippet
=
snippet
,
nl
=
os
.
linesep
)
summary
=
summary
[:
-
(
len
(
os
.
linesep
))]
print
(
"[run_snippets.py] SUMMARY:"
)
print
(
summary
.
format
())
if
len
(
failed
):
print
(
"[run_snippets.py] ERRORS ({failed}) while running snippets"
.
format
(
failed
=
len
(
failed
)))
sys
.
exit
(
1
)
else
:
print
(
"[run_snippets.py] OK ({succeeded})"
.
format
(
succeeded
=
len
(
succeeded
)))
if
__name__
==
"__main__"
:
main
()
Back
|
FazBrowse Home
|
New Git URL