12 2021 档案
摘要:1. 首先新建一个包 package 2. 新建一个文件, 文件中包含类 class Calculator: def add(self,a,b): return a + b def div(self,a,b): return a / b 3. 新建一个调用这个类的文件 from pythoncode
阅读全文
摘要:1. 进入设置,选择pytest 2. 安装pytest 3. 两种执行形式 1)点击绿色的 Run pytest for xxx 执行 2)在Terminal中执行
阅读全文
摘要:代码 >本地的git仓库 >远程的git仓库 1. 右击 open in terminal 2. 使用 git init 3. 点击commit 4. 可以将部分文件(比如.idea 和 venv)添加到 .gitignore 5.新建一个仓库 6. 添加remote仓库 7. 点击push
阅读全文
摘要:官网:http://allure.qatools.ru/ mac: brew install allure #下载 国内安装homebrew: /bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homeb
阅读全文
摘要:import pytest import yaml def func(x): return x + 1 @pytest.mark.parametrize(["a","b"],yaml.safe_load(open("./data.yaml"))) def test_answer(a,b): asse
阅读全文
摘要:import pytest @pytest.fixture def login(): print("登录操作") username = "xuefeifei" return username class TestDemo: def test_a(self,login): print(f"a name
阅读全文
摘要:@pytest.mark.parametrize("a,b",[(1,2),(5,8),(8,0)]) def test_answer(a,b): assert func(a) == b 另外可以用 元组或者列表 @pytest.mark.parametrize(("a","b"),[(1,2),(
阅读全文
摘要:pytest 测试用例的识别与运行 测试文件:test_*.py 和 *_test.py 以test开头或结尾的文件 测试用例:Test*类包含的所有 test_*的方法(测试类不能带有__init__方法), 不在class中的所有test_*的方法 def func(x): return x +
阅读全文
摘要:import requests r = requests.get("https://www.baidu.com") print(r.status_code)
阅读全文
摘要:import os print(os.listdir()) #列出当前目录下的文件 print(os.getcwd()) #获取绝对路径 if not os.path.exists("b"): os.mkdir("b") if not os.path.exists("b/test.ext"): f
阅读全文
摘要:def add(*args,**kargs): ##列表和字典 tmp = 0 print(kargs) for i in args: tmp += i for i in kargs: tmp += kargs[i] return tmp print(add(3,4,5,m=1,n=2))
阅读全文
摘要:1. Person.py class Person: def __init__(self,name,age): self.name = name self.age = age def __del__(self): print("person is reclaimed.") def wakeup(se
阅读全文
摘要:class Person: def __init__(self,name,age): self.name = name self.age = age def __del__(self): print("person is reclaimed.") def wakeup(self,at): print
阅读全文
摘要:#设置提交git的用户名字和邮箱 git config --global user.name xuefeifei git config --global user.email '541734041@qq.com' #具体命令 mkdir git-learning 创建一个目录 cd git-lear
阅读全文
摘要:ls 列出当前目录 rm -rf test.sh 删除当前目录下的 test.sh 文件 vim test.sh 创建一个文件 (点击i 进入insert模式, 点击esc退出输入模式。 之后:wq 保存) 运行: 方式1: 先赋权限,再执行 1)chmod +x test.sh 2)./test.
阅读全文

浙公网安备 33010602011771号