- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想在 PyCharm 中使用 pytest 和 pytest-cov 插件,所以我在编辑配置时将 --cov=package
添加到“Additional arguments”输入字段。但是,我得到了输出和错误,不知道为什么:
Testing started at 4:50 PM ...
/home/alex/.repos/codelib/github/dsa/env/bin/python /home/alex/Downloads/pycharm-2019.3.4/plugins/python/helpers/pycharm/_jb_pytest_runner.py --path /home/alex/.repos/codelib/github/dsa/ -- --cov=bag
Launching pytest with arguments --cov=bag /home/alex/.repos/codelib/github/dsa/ in /home/alex/.repos/codelib/github/dsa/bag/tests
============================= test session starts ==============================
platform linux -- Python 3.6.9, pytest-5.4.1, py-1.8.1, pluggy-0.13.1 -- /home/alex/.repos/codelib/github/dsa/env/bin/python
cachedir: .pytest_cache
rootdir: /home/alex/.repos/codelib/github/dsa
plugins: cov-2.8.1
collecting ... collected 1 item
test_simple_bag.py::test_len PASSED [100%]
Coverage statistics reporting failed
Traceback (most recent call last):
File "/home/alex/Downloads/pycharm-2019.3.4/plugins/python/helpers/pycharm/teamcity/pytest_plugin.py", line 371, in pytest_terminal_summary
self._report_coverage()
File "/home/alex/Downloads/pycharm-2019.3.4/plugins/python/helpers/pycharm/teamcity/pytest_plugin.py", line 378, in _report_coverage
from coverage.report import Reporter
ImportError: cannot import name 'Reporter'
----------- coverage: platform linux, python 3.6.9-final-0 -----------
Name Stmts Miss Cover
----------------------------------------------------------------------------
/home/alex/.repos/codelib/github/dsa/bag/__init__.py 0 0 100%
/home/alex/.repos/codelib/github/dsa/bag/simple_bag.py 17 5 71%
__init__.py 0 0 100%
test_simple_bag.py 6 0 100%
----------------------------------------------------------------------------
TOTAL 23 5 78%
============================== 1 passed in 0.03s ===============================
Process finished with exit code 0
当我从终端运行测试时,一切正常:
(env) alex@smartalex-pc:~/.repos/codelib/github/dsa$ pytest --cov=bag
============================================== test session starts ===============================================
platform linux -- Python 3.6.9, pytest-5.4.1, py-1.8.1, pluggy-0.13.1
rootdir: /home/alex/.repos/codelib/github/dsa
plugins: cov-2.8.1
collected 1 item
bag/tests/test_simple_bag.py . [100%]
----------- coverage: platform linux, python 3.6.9-final-0 -----------
Name Stmts Miss Cover
--------------------------------------------------
bag/__init__.py 0 0 100%
bag/simple_bag.py 17 5 71%
bag/tests/__init__.py 0 0 100%
bag/tests/test_simple_bag.py 6 0 100%
--------------------------------------------------
TOTAL 23 5 78%
=============================================== 1 passed in 0.03s ================================================
(env) alex@smartalex-pc:~/.repos/codelib/github/dsa$
最佳答案
那是因为 PyCharm 的测试插件还没有适应 coverage>=5.0
中的重大变化。这是 JetBrain 跟踪器中的一个相关问题:PY-40980 .在问题解决之前,将 coverage
固定到以前的主要内容:
$ pip install 'coverage<5'
关于python - 从 PyCharm 内部使用 pytest-cov 插件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60974076/
我知道可以在类型前添加#noinspection PyPep8Naming,但我想不通如何为单个文件全局设置。 我发现此功能适用于 some other JetBrains IDEs , 但未能在 P
我认为,在 PyCharm 的模块中重构函数名称通常会在项目范围内重构对该函数名称的任何使用。但是,我注意到项目中的笔记本中的功能没有被重构。重构时有没有办法包含笔记本? 我注意到 jupyter n
我需要使用 HTMLTestRunner 生成测试报告,因为该代码(位于文件末尾)是: suite = unittest.TestLoader().loadTestsFromTestCase(Test
Local History 是 Jetbrains IDE 系列(包括 Pycharm)绝对基础/关键的功能。为什么 .ipynb 文件会丢失?这是右键单击/上下文菜单 - 其中缺少 Show His
正如问题所问,如何在整个项目中的pycharm中运行查找/替换单词? 最佳答案 Edit | Find | Replace in Path。 快捷方式:Ctrl + Shift + R 关于pycha
我最近从 Spyder 更改为 PyCharm 作为 Python IDE。在 Spyder 中,我经常使用变量资源管理器功能(见图)。 PyCharm 中也提供此功能吗? 我找到了这个here ,“
嗨,我正在使用 pycharm 进行 python 开发。在 pycharm 中打开我的 python 项目时,它的打开方式如下图所示,其中我的项目名称是election,在此之前出现的选项卡都是父目
在 PyCharm 中,我的项目窗口中有一个文件夹是红色的。当所有其他文件夹都是蓝色时,该颜色意味着什么?我在 Git 中有我的项目,它主要是 Python,在 repo 中有一个 Java GUI。
我在我的 PyCharm 项目/文件栏中看到了这个: 我不确定这意味着什么,也不知道我为什么要这么做。谷歌搜索似乎没有提供任何有用的信息。有谁知道它是什么以及如何删除它?此外,项目中没有其他数字(没有
似乎 Pycharm 中的折叠自定义区域在某些缩进级别后不起作用。 这个不起作用: def test_a(): def function(): for g in group:
每当我创建一个函数、将其设为 View 并将模板映射到其上时,PyCharm 中的自动完成功能都会起作用。如果您输入类似 {{ book. }},其中 book 是一个模型,并且是您的上下文对象之一,
很长一段时间以来,我一直在寻找一种在 PyCharm 中折叠评论的方法。基本上我一直在寻找一种方法来实现与代码块相同的 + 注释。 最佳答案 用很容易做到这一点 #region Description
我正在使用 PyCharm 社区版 2016,我注意到我无法打开大数据输入文件或日志 (20MB)。编辑器只是说“文件 XXX 太大 (SIZE)”。 不仅如此,似乎也没有办法改变极限。官方文档提到了
在 PyCharm 中,我的项目窗口中有一个文件夹是红色的。当所有其他文件夹都是蓝色时,该颜色意味着什么?我在 Git 中有我的项目,它主要是 Python,在 repo 中有一个 Java GUI。
我想为 Pycharm 中的每个项目使用单独的虚拟环境。为此,我为每个项目创建了一个虚拟环境。我找不到清晰的文档 如果我想通过 PIP 命令添加或删除内容时需要为每个项目激活/停用这些虚拟环境,或者在
PyCharm 中是否有智能区分大小写搜索? 过去,我使用了一个编辑器,如果我使用小写字母,它会进行不区分大小写的搜索。 一旦我使用了第一个大写字符,搜索就区分大小写。 我喜欢这个。 我可以在 PyC
我已经按照 https://www.jetbrains.com/help/pycharm/requirements-installation-and-launching.html#linux 上的说明
有什么问题? 我在 PyCharm(版本 2016.1.4)中使用远程解释器(不是调试服务器!)进行远程调试,如下所述:jetbrains website . 当我在 Debug模式下运行时,程序会在
tldr;我希望我可以进入一个特定的程序状态,然后停止,然后继续编辑同一个文件,并使用这个过程迭代地向文件添加代码。 详情: 我经常想做的是使用python控制台或者在特定的程序状态下运行一段特定的代
有没有办法选择 PyCharm 中当前选定行下方的所有行(类似于在 Mac 中您可以使用 Cmd + Shift + down 选择行)? Cmd + Shift + right/left 工作正常,
我是一名优秀的程序员,十分优秀!