pyflakes

Pytest权威教程17-安装和使用插件

自古美人都是妖i 提交于 2021-01-14 03:00:46
[TOC] 返回: Pytest权威教程 安装和使用插件 本节讨论如何安装和使用第三方插件。有关编写自己的插件的信息,请参阅编写插件。 安装第三方插件可以通过以下方式轻松完成 pip : pip install pytest-NAME pip uninstall pytest-NAME 如果安装了插件,则 pytest 自动查找并集成它,无需激活它。 这是一些常用插件列表: pytest-django:为django应用程序编写测试。 pytest-twisted:为twisted应用程序编写测试,启动反应堆并处理测试函数的延迟。 pytest-cov:覆盖率报告,与分布式测试兼容 pytest-xdist:将测试分发到CPU和远程主机,以盒装模式运行,允许分段故障,在looponfailing模式下运行,自动重新运行文件更改的失败测试。 pytest-instafail:在测试运行期间报告失败。 pytest-bdd使用行为驱动的测试编写测试。 pytest-timeout:根据函数标记或全局定义进行超时测试。 pytest-pep8: --pep8 启用PEP8合规性检查的选项。 pytest-flakes:用pyflakes检查源代码。 oejskit:在实时浏览器中运行javascript unittests的插件。

如何使用pyflakes给python做语法检查

最后都变了- 提交于 2020-03-01 21:46:53
python是一门动态语言。在给python传参数的时候并没有严格的类型限制。写python程序的时候,发现错误经常只能在执行的时候发现。有一些错误由于隐藏的比较深,只有特定逻辑才会触发,往往导致需要花很多时间才能将语法错误慢慢排查出来。其实有一些错误是很明显的,假如能在写程序的时候发现这些错误,就能提高工作效率。最近我发现,可以用pyflakes这个程序对python语法进行语法检查,这样可以尽量早的发现错误。pyflakes有三种使用方法,第一种是当作命令行工具使用。第二种可以作为vim的插件,在vim编辑器中使用,实现所见即所得。第三种是可以在emacs中使用。 pyflakes作为命令行工具 安装pyflakes这个程序很简单。可以在pyflakes的官网这个网站进行下载: http://pypi.python.org/pypi/pyflakes 这是一个命令行工具。在linux下,可以直接运行 ‘pyflakes 文件名’ 对文件进行语法检查。 在vim编辑器中使用pyflakes 首先要确保vim支持python2.5以上版本,如果不确定是否支持,请在vim中运行命令。 <!-- lang: shell --> :version 结果例如: +代表支持的功能,-代表不支持的功能。由于上图所示的vim不支持python, 所以需要重新编译vim。 要编译支持python2

PyLint,PyChecker还是PyFlakes? [关闭]

萝らか妹 提交于 2020-02-26 05:25:27
我想获得一些关于这些工具的反馈: 特征; 适应性; 易用性和学习曲线。 #1楼 好吧,我有点好奇,所以我只是在问了问题之后立即测试了3个人;-) 好的,这不是一个非常认真的评论,但我可以这么说: 我在以下脚本中尝试 使用默认设置 的工具(这很重要,因为您可以选择检查规则): #!/usr/local/bin/python # by Daniel Rosengren modified by e-satis import sys, time stdout = sys.stdout BAILOUT = 16 MAX_ITERATIONS = 1000 class Iterator(object) : def __init__(self): print 'Rendering...' for y in xrange(-39, 39): stdout.write('\n') for x in xrange(-39, 39): if self.mandelbrot(x/40.0, y/40.0) : stdout.write(' ') else: stdout.write('*') def mandelbrot(self, x, y): cr = y - 0.5 ci = x zi = 0.0 zr = 0.0 for i in xrange(MAX_ITERATIONS) : temp =

How do I get Pyflakes to ignore a statement?

一世执手 提交于 2020-01-18 19:38:50
问题 A lot of our modules start with: try: import json except ImportError: from django.utils import simplejson as json # Python 2.4 fallback. ...and it's the only Pyflakes warning in the entire file: foo/bar.py:14: redefinition of unused 'json' from line 12 How can I get Pyflakes to ignore this? (Normally I'd go read the docs but the link is broken. If nobody has an answer, I'll just read the source.) 回答1: If you can use flake8 instead - which wraps pyflakes as well as the pep8 checker - a line

How do I get Pyflakes to ignore a statement?

瘦欲@ 提交于 2020-01-18 19:38:46
问题 A lot of our modules start with: try: import json except ImportError: from django.utils import simplejson as json # Python 2.4 fallback. ...and it's the only Pyflakes warning in the entire file: foo/bar.py:14: redefinition of unused 'json' from line 12 How can I get Pyflakes to ignore this? (Normally I'd go read the docs but the link is broken. If nobody has an answer, I'll just read the source.) 回答1: If you can use flake8 instead - which wraps pyflakes as well as the pep8 checker - a line

How do I get Pyflakes to ignore a statement?

时光怂恿深爱的人放手 提交于 2020-01-18 19:38:29
问题 A lot of our modules start with: try: import json except ImportError: from django.utils import simplejson as json # Python 2.4 fallback. ...and it's the only Pyflakes warning in the entire file: foo/bar.py:14: redefinition of unused 'json' from line 12 How can I get Pyflakes to ignore this? (Normally I'd go read the docs but the link is broken. If nobody has an answer, I'll just read the source.) 回答1: If you can use flake8 instead - which wraps pyflakes as well as the pep8 checker - a line

How do I get Pyflakes to ignore a statement?

北城以北 提交于 2020-01-18 19:37:45
问题 A lot of our modules start with: try: import json except ImportError: from django.utils import simplejson as json # Python 2.4 fallback. ...and it's the only Pyflakes warning in the entire file: foo/bar.py:14: redefinition of unused 'json' from line 12 How can I get Pyflakes to ignore this? (Normally I'd go read the docs but the link is broken. If nobody has an answer, I'll just read the source.) 回答1: If you can use flake8 instead - which wraps pyflakes as well as the pep8 checker - a line

Sublimelinter 4.0.2 new update can no longer find any of my linters

谁说胖子不能爱 提交于 2020-01-05 05:54:43
问题 So after opening up sublime sublimelinter updated and now none of my linters work. I have looked around online and had no luck. when I updated it said that I can manually install the old version but I much rather use the newer version. I am not sure as to how to change the path to my linters. I am sure its something simple. I am new to coding so any and all help will be appreciated. thanks DPI scale: 1.25 startup, version: 3143 windows x64 channel: stable executable: /C/Program Files/Sublime

How to avoid flake8's “F821 undefined name '_'” when _ has been installed by gettext?

本秂侑毒 提交于 2020-01-03 08:30:22
问题 Problem overview: In my project's main script, gettext installs the function _() that is used in other modules for translations (like in print(_('Something to translate')) ). As stated by the doc: the _() function [is] installed in Python’s builtins namespace, so it is easily accessible in all modules of your application. So, everything runs fine. Only problem : flake8 shows errors (actually returned by PyFlakes): $ flake8 *.py lib.py:2:12: F821 undefined name '_' main_script.py:8:7: F821

How would I start integrating pyflakes with Hudson

随声附和 提交于 2019-12-22 04:12:30
问题 We use Hudson for continuous integration with the Violations Plugin which parses our output from pylint. However, pylint is a bit too strict, and hard to configure. What we'd rather use is pyflakes which would give us the right level of "You're doing it wrong." 回答1: You can adapt pyflakes and pep8 output to work with the Violations pylint plugin. pyflakes path/to/src | awk -F\: '{printf "%s:%s: [E]%s\n", $1, $2, $3}' > violations.pyflakes.txt pep8 path/to/src | awk -F\: '{printf "%s:%s: [%s]