pytest

“Apps aren't loaded yet” when trying to run pytest-django

ぃ、小莉子 提交于 2021-01-27 02:10:45
问题 Using the (partial) polls app from the Django tutorial as an example, I'm trying to get pytest-django to run. Using the command django-admin startproject mysite2 , I've created a project directory with the following structure: . ├── db.sqlite3 ├── manage.py ├── mysite2 │ ├── __init__.py │ ├── settings.py │ ├── urls.py │ └── wsgi.py ├── polls │ ├── __init__.py │ ├── admin.py │ ├── apps.py │ ├── migrations │ │ ├── 0001_initial.py │ │ └── __init__.py │ ├── models.py │ ├── tests.py │ ├── urls.py

Pytest - no tests ran

南笙酒味 提交于 2021-01-26 19:25:37
问题 I'm using pytest and selenium. When I try run my test script: import pytest from selenium import webdriver from pages import * from locators import * from selenium.webdriver.common.by import By import time class RegisterNewInstructor: def setup_class(cls): cls.driver = webdriver.Firefox() cls.driver.get("http://mytest.com") def test_01_clickBecomeTopButtom(self): page = HomePage(self.driver) page.click_become_top_button() self.assertTrue(page.check_instructor_form_page_loaded()) def teardown

Pytest - no tests ran

蹲街弑〆低调 提交于 2021-01-26 19:23:59
问题 I'm using pytest and selenium. When I try run my test script: import pytest from selenium import webdriver from pages import * from locators import * from selenium.webdriver.common.by import By import time class RegisterNewInstructor: def setup_class(cls): cls.driver = webdriver.Firefox() cls.driver.get("http://mytest.com") def test_01_clickBecomeTopButtom(self): page = HomePage(self.driver) page.click_become_top_button() self.assertTrue(page.check_instructor_form_page_loaded()) def teardown

How can I get my assertions in pytest to stop being abbreviated with ellipsis?

你离开我真会死。 提交于 2021-01-26 09:49:52
问题 How can I get my assertions in pytest to stop being abbreviated with ellipsis ? Every time I have an assertion that reports error it truncates all my strings with "..." why is that? how can I stop that? 回答1: Could you show an example? This is how the output looks for me: def test_foo(): > assert "a"*100 == "a"*100 + "b" E assert 'aaaaaaaaaaaa...aaaaaaaaaaaaa' == 'aaaaaaaaaaaaa...aaaaaaaaaaaab' E Skipping 89 identical leading characters in diff, use -v to show E - aaaaaaaaaaa E + aaaaaaaaaaab

究极全面炼丹教程,使用PaddleOCR并自己训练模型,太上老君看了都说好

筅森魡賤 提交于 2021-01-25 11:05:29
使用PaddleOCR,训练自己的模型 前言______PaddleOcr的安装与准备工作 资料准备 1. 下载icdar2015图片集 2. 下载icdar2015数据集配套的标注文件 3.组织数据集路径 4.下载预训练模型 5.组织预训练模型路径 6.修改配置文件 ~~设置完成,开始训练~~ 到了紧张刺激的DEBUG环节才对 如何制作自己的数据集? 模型评估与模型检查 ps:为方便读者文章中需要用到的文件均使用我的网盘分享下载,同时也会给出官网下载地址 前言______PaddleOcr的安装与准备工作 1.PaddleOcr相关组件安装我在上一个博客中已经介绍完毕→ PaddleOcr安装与使用全程指南 ←点击跳转 2.下载PaddleOcr官方文件包, https://kyc592.lanzous.com/i5C7Gkojm7c 密码:kyc 或官网下载地址:https://gitee.com/paddlepaddle/PaddleOCR 然后解压到项目文件夹的根目录下。 一定确保按照前一篇博客操作完毕,Paddleocr可以正常运行,尽量减少待会出现的极 其 繁 重的debug工作。 至此完成准备工作。 资料准备 训练自己的模型,需要的资料有: ①训练用的图片集 ②测试用的图片集 ③前面两个图片集配套的标注文件 ④预训练模型 1. 下载icdar2015图片集 演示采用的

测试金字塔的奥秘和数学

£可爱£侵袭症+ 提交于 2021-01-22 09:44:41
三角形的故事 它可能被称为“测试自动化金字塔”,但在大多数情况下看起来都像三角形一样可怕。如果使用吉萨大金字塔的尺寸和本文中讨论的数学方程式,您将最终对测试金字塔的每一层的作用和依赖性以及建立牢固基础的重要性有更深入的了解。 通过将自动测试金字塔视为一个三角形,我们可以使用几何和三角元素查找每个级别的大小。为了弄清楚这一点,我们首先将金字塔分解成3个独立的三角形。我们将确定每个三角形的面积,然后使用切片技术确定每个级别的大小。 我们需要做的第一步是使用来自吉萨大金字塔的这些尺寸来找到三角形的总面积: 使用这些尺寸,我们可以找到组成金字塔一侧的三角形的总面积。 面积=½(230 * 147)≈16905 从顶部(UI级别)开始,我们可以找出每个级别的大小以及它所占整个金字塔的百分比。 用户界面级别 将大金字塔的高度平均分为3个部分,这意味着我们的顶部UI层高49米。 现在,我们可以使用一些三角函数和 勾股定理 来查找该三角形的区域,以查看所涉及的数学细节 。 通过数学运算,我们发现金字塔的UI层的面积为1909.4,约占金字塔总数的11%。 服务级别 使用相同的过程找到中间层的面积,我们发现金字塔的服务层为5726.76,约占金字塔总数的33%。 单位等级 为了找到单位层的面积,我们从测试金字塔的总面积中减去服务和UI层的总面积 16905-5726.76-1909.4 = 9268

Pytest skip test with certain parameter value

风流意气都作罢 提交于 2021-01-22 04:23:14
问题 I have tests that I want to parameterize, but there are certain tests that should only be applied to one value of the parameters. To give a specific example, below, I would like to apply parameters one and two to test_A , but only supply parameter one to test_B . Current Code @pytest.fixture(params=['one', 'two']) def data(request): if request.param == 'one' data = 5 return data def test_A(data): assert True def test_B(data): assert True Desired Results I basically want something that looks

Pytest skip test with certain parameter value

狂风中的少年 提交于 2021-01-22 04:22:19
问题 I have tests that I want to parameterize, but there are certain tests that should only be applied to one value of the parameters. To give a specific example, below, I would like to apply parameters one and two to test_A , but only supply parameter one to test_B . Current Code @pytest.fixture(params=['one', 'two']) def data(request): if request.param == 'one' data = 5 return data def test_A(data): assert True def test_B(data): assert True Desired Results I basically want something that looks

Pytest skip test with certain parameter value

偶尔善良 提交于 2021-01-22 04:21:10
问题 I have tests that I want to parameterize, but there are certain tests that should only be applied to one value of the parameters. To give a specific example, below, I would like to apply parameters one and two to test_A , but only supply parameter one to test_B . Current Code @pytest.fixture(params=['one', 'two']) def data(request): if request.param == 'one' data = 5 return data def test_A(data): assert True def test_B(data): assert True Desired Results I basically want something that looks

how to pass command line argument from pytest to code

折月煮酒 提交于 2021-01-22 04:19:06
问题 I am trying to pass arguments from a pytest testcase to a module being tested. For example, using the main.py from Python boilerplate, I can run it from the command line as: $ python3 main.py usage: main.py [-h] [-f] [-n NAME] [-v] [--version] arg main.py: error: the following arguments are required: arg $ python3 main.py xx hello world Namespace(arg='xx', flag=False, name=None, verbose=0) Now I am trying to do the same with pytest, with the following test_sample.py ( NOTE: the main.py