Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
test
autotest-airtest-web-spd
Commits
affbbadb
Commit
affbbadb
authored
Jan 19, 2024
by
xiao-hesheng
Browse files
产品信息变更增加异常场景脚本
parent
c097e7e7
Changes
2
Hide whitespace changes
Inline
Side-by-side
common/db/sql/sql_del_branch_info.py
View file @
affbbadb
...
@@ -5,17 +5,29 @@ import pymysql
...
@@ -5,17 +5,29 @@ import pymysql
class
delByBranchId
(
object
):
class
delByBranchId
(
object
):
def
Delete_branch_by_id
(
self
,
id
):
def
Delete_branch_by_id
(
self
):
connection
=
pymysql
.
connect
(
host
=
"10.17.65.108"
,
user
=
"root"
,
password
=
"Cmic.2023"
,
database
=
"spd3_herp_test2"
,
connection
=
pymysql
.
connect
(
host
=
"10.17.65.108"
,
user
=
"root"
,
password
=
"Cmic.2023"
,
database
=
"spd3_herp_test2"
,
charset
=
"utf8"
)
charset
=
"utf8"
)
cursor
=
connection
.
cursor
()
cursor
=
connection
.
cursor
()
# 删除新增的院区数据,减少垃圾数据的产生,保证脚本下次还可以正常运行,接口脚本每次都使用新增数据
# 删除新增的院区数据,减少垃圾数据的产生,保证脚本下次还可以正常运行,接口脚本每次都使用新增数据
sql
=
"DELETE from mcms_branch_info where id = '%s';"
%
id
# sql = "DELETE from mcms_branch_info where id = '%s';" % id
sql
=
"DELETE from mcms_branch_info where name like '%东土城路院区_____';"
print
(
sql
)
print
(
sql
)
cursor
.
execute
(
sql
)
cursor
.
execute
(
sql
)
cursor
.
execute
(
"commit;"
)
cursor
.
execute
(
"commit;"
)
print
(
'
%s
院区数据已删除成功'
%
id
)
print
(
'院区数据已删除成功'
)
cursor
.
close
()
cursor
.
close
()
def
Delete_goods_change_info
(
self
):
# delByBranchId().Delete_branch_by_name('11122222')
connection
=
pymysql
.
connect
(
host
=
"10.17.65.108"
,
user
=
"root"
,
password
=
"Cmic.2023"
,
database
=
"spd3_herp_test2"
,
\ No newline at end of file
charset
=
"utf8"
)
cursor
=
connection
.
cursor
()
# 删除产品信息修改数据
sql
=
"DELETE from mcms_goods_chg_main where create_user='UID-050151';"
print
(
sql
)
cursor
.
execute
(
sql
)
cursor
.
execute
(
"commit;"
)
print
(
'产品调价和产品信息变更数据已删除成功'
)
cursor
.
close
()
# delByBranchId().Delete_branch_by_id()
delByBranchId
().
Delete_goods_change_info
()
\ No newline at end of file
runner.py
View file @
affbbadb
...
@@ -5,6 +5,8 @@ import platform
...
@@ -5,6 +5,8 @@ import platform
import
shutil
import
shutil
import
common.run_case_conditions
as
run
import
common.run_case_conditions
as
run
import
common.case_tag_get
as
case_tag_get
import
common.case_tag_get
as
case_tag_get
from
common.db.sql.sql_del_branch_info
import
delByBranchId
curPath
=
os
.
path
.
abspath
(
os
.
path
.
dirname
(
__file__
))
curPath
=
os
.
path
.
abspath
(
os
.
path
.
dirname
(
__file__
))
rootPath
=
os
.
path
.
split
(
curPath
)[
0
]
rootPath
=
os
.
path
.
split
(
curPath
)[
0
]
sys
.
path
.
append
(
rootPath
)
sys
.
path
.
append
(
rootPath
)
...
@@ -90,4 +92,7 @@ if __name__ == '__main__':
...
@@ -90,4 +92,7 @@ if __name__ == '__main__':
os
.
remove
(
del_file
)
os
.
remove
(
del_file
)
shutil
.
rmtree
(
file_path
)
shutil
.
rmtree
(
file_path
)
print
(
'删了什么文件'
,
del_file
)
print
(
'删了什么文件'
,
del_file
)
print
(
'结束了'
)
print
(
'结束了'
)
\ No newline at end of file
#删除自动化脚本产生的数据
delByBranchId
().
Delete_branch_by_id
()
delByBranchId
().
Delete_goods_change_info
()
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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