自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(34)
  • 收藏
  • 关注

原创 httprunner2使用

regex_match: expect_value写一个正则表达式,如果实际结果能正则表达式匹配成功,需要注意的是re.match和re.search是不一样的,match代表正则表达式必须从实际结果字符串开始的地方匹配,如果需要更复杂的场景,可以把httprunner源码copy到项目目录下,将match修改成search。config中没有设置,取testseps中参数 testcase中参数会覆盖api文件中参数。如果是hook调用初始化和清除方法:['${hook_print(用例结束执行)}']

2023-08-21 11:11:06 164

原创 xmind用例数据上传至禅道

代码里需填写禅道对应登录账号及用例所属产品。

2023-08-11 14:01:09 441

原创 python logging日志根据等级适配颜色

logging模块,日志等级颜色设置

2023-03-06 17:15:24 1071

原创 python元类执行顺序及元类单例模式实现

python元类

2022-10-03 17:43:00 289

原创 K8S-持续集成实践

镜像:vi dockerfileFROM 10.0.0.11:5000/nginx:1.13ADD . /usr/share/nginx/htmlvi .dockerignore dockerfiledocker build -t xiaoniao:v1 .docker run -d -p 88:80 xiaoniao:v1jenkins:使用jenkins环境变量BUILD_ID修改构建后脚本为docker build -t 10.0.0.11:5000/x

2022-05-15 17:00:40 438

原创 python logger日志管理

普通日志生成logger代码:import osimport timeimport logging.configfrom logging.handlers import TimedRotatingFileHandler# 确定日志文件及等级log_file_name = time.strftime("%Y-%m-%d", time.gmtime()) + '.log'LOG_FILE = os.path.join(os.path.dirname(__file__), log_file_n

2022-04-27 10:49:51 1138 1

原创 git使用

1.注册账号,github或者gitee本地配置:git config --global user.name "your name"git config --global user.email "your email"查看配置git config --global --list2.项目初始化第一种:去github或者gitee创建项目git clone https://gitee.com/xxxx/xxxx.git #clone项目到本地git branch d...

2022-04-03 22:44:21 471

原创 pytest插件编写

看一下pytest-repeat插件代码:import warningsfrom unittest import TestCaseimport pytestdef pytest_addoption(parser): #pytest添加命令行参数 parser.addoption( '--count', action='store', default=1, type=int, help='Numbe

2022-03-21 10:28:07 6695 1

原创 python协程理解

定义一个A生成器,B中调用send(None)激活A,yield值1即from_aB进入循环,send(to_a)即第一次传'x'值给a,a中from_b接收到b的值,执行到yield to_b传入值2给from_a'y'->a->'3'->b->'z'->a->抛出StopIterationimport timedef A(): a_list=['1','2','3'] for to_b in a_list: print(

2022-02-15 23:05:28 238

原创 django 登陆功能学习记录

python manage startapp usersmodel添加字段:class UserProfile(AbstractUser): nick_name = models.CharField(max_length=50, verbose_name=u"昵称", default="") birthday = models.DateField(verbose_name=u"生日", null=True, blank=True) gender = models.CharF

2021-11-07 23:16:40 468

原创 drf配置

# from rest_framework import permissions,parsers,renderers,authentication,schemasREST_FRAMEWORK = { 'DEFAULT_SCHEMA_CLASS':'rest_framework.schemas.coreapi.AutoSchema', 'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination',.

2021-10-25 09:29:39 127

原创 python selenium gird

python demofrom selenium import webdriverfrom selenium.webdriver import DesiredCapabilitiesimport timeimport pytestclass Driver(): hub_url='127.0.0.1:5001/wd/hub' def chrome(self): capability=DesiredCapabilities.CHROME dr

2021-10-07 19:03:00 342

原创 python获取线程返回结果,简单重写Thred类run方法

import threadingclass MyThread(threading.Thread): def __init__(self,*args,**kwargs): threading.Thread.__init__(self,*args,**kwargs) def run(self) -> None: try: if self._target: self.result=self..

2021-10-07 10:05:36 363

原创 docker使用

概念:docker镜像:每一个镜像可以依赖于一个或多个镜像组成另一个镜像,AUFS文件系统docker仓库:集中存放镜像的仓库docker容器:镜像运行后的进程,容器与镜像之间的关系类似于类与实类docker命令docker version 查看docker版本信息docker info 查看docker配置信息镜像管理docker images 查看所有镜像docker search nginx 搜索镜像docker pull n...

2021-10-07 01:11:47 4740 1

原创 celery使用

#安装:pip install celery创建一个celery_app目录__init__.py文件下from celery import Celeryapp=Celery('demo')app.config_from_object('celery_app.celery_config')celery_config.pyfrom datetime import timedeltafrom celery.schedules import crontabbroker..

2021-09-25 21:47:30 351 2

原创 attrdict实现

class AttrDict(dict): def __init__(self,*args,**kwargs): super().__init__(*args,**kwargs) def operation_list(self,value): new_value = [] for v in value: if isinstance(v, dict): new_value.appen..

2021-08-19 14:38:03 502

原创 python 类绑定与实例绑定属性

from types import MethodTypeclass Bar: def ge(self): return 'ge' def score(self): return 'score'def query(self,sql): return sql+self.ge()+self.score()def _find(self,fi): return fi+self.ge()+self.score()Bar.find=_f.

2021-08-18 19:42:49 143

原创 flask sqlalchemy数据库关系表结构

class Comment(db.Model): """评论""" id = db.Column(db.Integer, primary_key=True) # 评论编号 content = db.Column(db.Text, nullable=False) # 评论内容 parent_id = db.Column(db.Integer, db.ForeignKey("comment.id")) # 父评论id parent = db.relationshi.

2021-08-14 11:22:47 259

原创 locust性能脚本参数化,每个用户使用不同的数据

import queuefrom locust import HttpUser,task,TaskSetclass AccountTask(TaskSet): def on_start(self): self.i=0 try: self.data = self.user.user_data.get() except queue.Empty: print('no data exist') .

2021-06-29 19:52:28 764

原创 appium driver参数及命令行参数

Capability Description Values automationName Which automation engine to use Appium(default), orUiAutomator2,Espresso, orUiAutomator1for Android, orXCUITestorInstrumentsfor iOS, orYouiEnginefor application built with You.i Engine...

2021-01-20 14:13:54 1492 2

原创 mock工具只moco简单使用

github地址:https://github.com/dreamhead/moco1.下载jar包2.配置configfile.json3.使用命令:java -jar moco-runner.jar start -c configfile.jsonjson格式内容如下:[ { "description": "无参GET请求", "request": { "uri": "/get", "metho

2021-01-19 18:53:13 246

原创 robotframework常用关键字

RUN KEYWORD AND RETURN STATUS 返回状态,抛出异常则返回False,否则返回Truefor循环,if判断FOR ${var} IN RANGE 5 ${var} RUN KEYWORD AND RETURN STATUS Wait Until Page Contains ${text} ${timeout} Run Keyword If '${var}' == 'True' 点击Native文.

2020-12-22 14:28:17 836

原创 线程停止方法

def _async_raise(tid, exctype): """raises the exception, performs cleanup if needed""" tid = ctypes.c_long(tid) if not inspect.isclass(exctype): exctype = type(exctype) res = ctypes.pythonapi.PyThreadState_SetAsyncExc(tid, ctypes.p.

2020-12-11 10:44:10 762 1

原创 django删除ImageField同时删除文件方法

from django.db import models# Create your models here.from django.db.models.signals import pre_deletefrom django.dispatch import receiverfrom user.models import Userclass ImgFiles(models.Model): user=models.CharField('用户名',max_length=64,null=.

2020-12-02 18:31:32 1524

原创 django+nginx+uwsgi部署django项目

https://www.cnblogs.com/fnng/p/5268633.html另补充下:使用nginx不需要此参数,如果直接使用uwsgi需要此参数访问静态文件:--static-map /static=/home/jenkins/codes/royal_ui/static部署步骤(强调):启动nignx绑定uwsgi,稳定点方法是先uwsgi --init myweb.ini,再/etc/init.d/nginx startnginx server如果/etc/nginx/n.

2020-11-20 17:14:56 143

原创 自动化开发cmd封装:

android:# !/usr/bin/env python3# coding=utf-8"""Copyright (C) 2016-2019 Zhiyang Liu in Software Development of NIO/NEXTEV) All rights reserved.Author: zhiyang.liu.o@nio.comDate: 2019-05-20History:---------------------------------------------Mod

2020-11-11 17:42:16 445

原创 django captcha使用

安装:pip install django-simple-captchasetting:url配置(使用的django1.11.29的版本,2.0版本使用path):然后同步数据库表:python manage.py makemigrationspython manage.py migrate定义验证码生产公共方法:from captcha.helpers import captcha_image_urlfrom captcha.models import Ca.

2020-11-02 18:59:37 1647

原创 mac无法安装dmg文件,报无可装载系统错误

1.sudo spctl --master-disable 开通安全任意来源2.重启command+R进入恢复模式(重启按至图标显示松手),csrutil查看下状态csrtuil status 查看状态csrutil disable 启动csrutil enable 禁止

2020-09-14 10:54:14 6040 2

原创 ios清除内存抓取log操作

#!/usr/bin/env python# -*- coding: utf-8 -*-"""Copyright (C) 2016-2019 Zhiyang Liu in Software Development of NIO/NEXTEV) All rights reserved.Author: zhiyang.liu.o@nio.comDate: 2019-05-20History:---------------------------------------------Modif.

2020-08-20 16:02:12 240

原创 图像查找

https://www.cnblogs.com/meitian/p/7417582.html

2020-01-03 16:55:17 100

原创 python性能测试locusts

locust文档:https://debugtalk.com/post/head-first-locust-user-guide/仅作自己收藏使用httpRunner:https://cn.httprunner.org

2019-11-26 17:20:58 166

原创 driver截图

def get_screen(self, name="截图", switch=True): print(datetime.datetime.now(), name) if switch is False: return im = Image.open(BytesIO(self.driver.get_screenshot_as_png())) # Imag...

2019-09-19 09:55:43 304

原创 pandas excel处理数据和生成折线图

import pandasfrom matplotlib import pyplot as pltfrom matplotlib.font_manager import FontPropertiesimport osimport numpyget_path=lambda p:os.path.join(os.path.dirname(__file__),'../result/%s'%p...

2019-09-04 16:08:30 2643

原创 brew报错、测试面试的一些问题

git clone fail:https://www.jianshu.com/p/c8d998903a6a下载不成功:https://www.jianshu.com/p/38e78f84b02c

2019-08-27 14:24:58 27

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除