Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
interfaceTest
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Schedules
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
zhaihuitao
interfaceTest
Commits
87d6f9bd
Commit
87d6f9bd
authored
Aug 05, 2020
by
zhaihuitao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加yaml工具类
parent
1caec78b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
4 deletions
+24
-4
analysis.py
config/analysis.py
+17
-3
click.py
testcase/android_click/click.py
+7
-1
No files found.
config/analysis.py
View file @
87d6f9bd
...
...
@@ -8,5 +8,20 @@
import
yaml
with
open
(
'/Users/zhaihuitao/gitlab/trackingIO/config/prod/prod.yaml'
,
'r+'
,
encoding
=
'utf-8'
)
as
f
:
config
=
yaml
.
load
(
f
)
\ No newline at end of file
class
loadYaml
:
def
read_yaml
(
self
,
filepath
):
try
:
return
yaml
.
load
(
open
(
filepath
,
'r'
,
encoding
=
'utf-8'
),
Loader
=
yaml
)
except
Exception
as
es
:
print
(
F
'读取{filepath}文件出错,错误是{es}'
)
return
False
def
write_yaml
(
self
,
filepath
,
data
,
mode
=
'w'
):
try
:
with
open
(
filepath
,
mode
,
encoding
=
'utf-8'
)
as
f
:
yaml
.
dump
(
data
,
f
)
return
True
except
Exception
as
es
:
print
(
F
'内容:{data}
\n
写入{filepath}文件出错,错误是{es}'
)
return
False
testcase/android_click/click.py
View file @
87d6f9bd
...
...
@@ -10,6 +10,9 @@ import random
import
requests
import
socket
import
struct
import
yaml
import
sys
sys
.
path
.
append
(
r'/Users/zhaihuitao/gitlab/trackingIO/config'
)
import
config.analysis
import
config.prod
import
time
...
...
@@ -60,7 +63,10 @@ for _ in range(1):
#timeout可以超时四秒
# verify = False
p
=
requests
.
get
(
url
=
config
[
'click'
][
'url'
],
params
=
parms
,
timeout
=
30
,
verify
=
False
)
# y = config.analysis.loadYaml()
# y.readYaml('/Users/zhaihuitao/gitlab/trackingIO/config/prod/prod.yaml')
y
=
yaml
.
load
(
open
(
'/Users/zhaihuitao/gitlab/trackingIO/config/prod/prod.yaml'
,
'r'
,
encoding
=
'utf-8'
))
p
=
requests
.
get
(
url
=
y
[
'click'
][
'url'
],
params
=
parms
,
timeout
=
30
,
verify
=
False
)
print
(
'success:'
,
s
)
# print(p.text)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment