40:441: execution error: The directory ‘/Users/lina/Library/Caches/pip/http’ or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions ...
Python
Mac的python版本从2.7升级到 3.8
1、下载python https://www.python.org/downloads/release/python-381/ image.png 2、安装python 3.8.1 下载好的pkg文件进行安装,安装完成之后,python 3.8.1的默认安装路径如下:执行: ope...
Python使用阿里云镜像
临时使用 pip install -i https://mirrors.aliyun.com/pypi/simple/ 包名 以后都使用阿里云的源 pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/ 查看设置的结果 pip ...
pytest 5 通过TyinDB读写json文件
import pytest import json from tinydb import TinyDB @pytest.fixture def db(): db = TinyDB("db.json") print("\n Setup DB") yield db #db.purge() print("/n Teardown DB") de...
Python3 yield使用总结
示例 import scrapy class QuotesSpider(scrapy.Spider): name = "quotes def start_requests(self): urls = [ 'http://quotes.toscrape.com/page/1/', 'ht...
pytest 4 @pytest.fixture运用2
test_people.py from test_case.people import Person, anyone_like_dogs import pytest @pytest.fixture() def person(): return Person(name = "Bob", favorite_animal = "dog") def test_anyone_l...
pytest 3 @mock.patch的运用
本案例使用了一个随机数加上变量实现测试出现随机的结果,暂时初略看过,需要再深入学习的内容 test_dnd.py from test_case.dnd import attack_damage from unittest import mock @mock.patch("dnd.randi...
Pytest 2 @pytest.fixture运用及对map结果的渐进测试方法
1、单文件实现效果 def greet(person): return "Hi {name}".format(**person) def test_greet(): bob = {"name":"Bob"} #Arrange greeting = greet(bob) #Act assert greeting == "Hi Bob...
Pytest 1 测试原理
1、定义测试文件、类、方法 2、定义assert关键字做运行结果与期待结果做比较 3、执行pytest def test_pass(): assert 1 + 1 == 2
Pytest-安装&运行
一、安装 1)新建项目,在PyCharm上进行安装pytest即可 2)两种安装方式,目测第二种比较受用 pip install-U pytest pip3 install pytest -i http://pypi.douban.com/simple/ --trusted-host p...