tox

pyls 配置

若如初见. 提交于 2020-02-26 15:54:22
设置代码行为 120 字 ~/.config/pycodestyle pycodestyle 官方文档 https://www.osgeo.cn/pycodestyle/intro.html 在项目级别,a setup.cfg 文件或 tox.ini 如果存在,则读取文件。如果这些文件都没有 [pycodestyle] 节,未加载项目特定的配置。 [pycodestyle] # count = False # ignore = E226,E302,E41 max-line-length = 120 # statistics = True pyls 的main #!/opt/miniconda3/bin/python # -*- coding: utf-8 -*- import re import sys from pyls.__main__ import main if __name__ == '__main__': sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) sys.exit(main()) python_ls.py 定义了 start_io_lang_server start_tcp_lang_server LINT_DEBOUNCE_S = 0.5 # 500 ms PARENT

强大的 Python 任务自动化工具!invoke 十分钟入门指南

浪尽此生 提交于 2020-02-26 09:15:40
接着前面的《 tox 教程 》,以及刚翻译好的《 nox文档 》,我们继续聊聊 Python 任务自动化的话题。 nox 的作者在去年的 Pycon US 上,做了一场题为《 Break the Cycle: Three excellent Python tools to automate repetitive tasks 》的分享(B站观看地址: https://b23.tv/av86640235),她介绍了三个任务自动化工具:tox、nox 和 invoke,本文的话题正好就是最后的 invoke。 1、invoke 可以做什么? invoke 是从著名的远程部署工具 Fabric 中分离出来的,它与 paramiko 一起是 Fabric 的两大最核心的基础组件。 除了作为命令行工具,它专注于“任务执行”(task execution),可以标注和组织任务,并通过 CLI(command-line interface,即命令行界面) 和 shell 命令来执行任务。 同样是任务自动化工具,invoke 与我们之前介绍过的 tox/nox 在侧重点上有所不同: tox/nox 主要是在打包、测试、持续集成等方面的自动化(当然它们能做的还不止于此) invoke 则更具普遍性,可以用在任何需要“执行任务”的场景,可以是无相关性的任务组,也可以是有顺序依赖的分步骤的工作流

How can I get tox and poetry to work together to support testing multiple versions of a Python dependency?

主宰稳场 提交于 2020-02-20 09:08:07
问题 I am switching a project that currently uses pipenv to poetry as a test to see what the differences are. The project is a simple, redistributable, Django app. It supports Python 3.6-8, and Django 2.2 and 3.0. I have a tox.ini file that covers all combinations of Python and Django thus: [tox] envlist = py{36,37,38}-django{22,30} [testenv] whitelist_externals = poetry skip_install = true deps = django22: Django==2.2 django30: Django==3.0 commands = poetry install -vvv poetry run pytest --cov=my

Python 任务自动化工具 tox 教程

╄→гoц情女王★ 提交于 2020-01-07 09:50:47
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 在我刚翻译完的 Python 打包 系列文章 中,作者提到了一个神奇的测试工具 tox,而且他本人就是 tox 的维护者之一。趁着话题的相关性,本文将对它做简单的介绍,说不定大家在开发项目时能够用得上。 > Command line driven CI frontend and development task automation tool > > 命令行驱动的 CI 前端和开发任务自动化工具 tox 的项目地址是: https://github.com/tox-dev/tox 其核心作用是支持创建隔离的 Python 环境,在里面可以安装不同版本的 Python 解释器与各种依赖库,以此方便开发者做自动化测试、打包、持续集成等事情。 简单来说, tox 是一个管理测试虚拟环境的命令行工具。 它已存在多年且广被开发者们使用,例如,著名的云计算平台 OpenStack 也采用了它,作为最基础的测试工具之一。 1、tox 能做什么? 细分的用途包括: 创建开发环境 运行静态代码分析与测试工具 自动化构建包 针对 tox 构建的软件包运行测试 检查软件包是否能在不同的 Python 版本/解释器中顺利安装 统一持续集成(CI)和基于命令行的测试 创建和部署项目文档 将软件包发布到 PyPI 或任何其它平台 tox

Trouble running python unit tests with tox - ImportError for module that is already installed

江枫思渺然 提交于 2020-01-06 09:37:12
问题 I am new to python and am trying to run unit tests for this project: https://github.com/matrix-org/synapse I am running tox from the top level of the project. I get this error: exceptions.ImportError: No module named pymacaroons But pymacaroons is already installed using pip. To my knowledge, I only have one version of python. Really stumped here. 回答1: tox creates its own virtual environments and installs dependencies according to tox.ini . pymacaroons is not listed in tox.ini hence it's not

Trouble running python unit tests with tox - ImportError for module that is already installed

爱⌒轻易说出口 提交于 2020-01-06 09:37:07
问题 I am new to python and am trying to run unit tests for this project: https://github.com/matrix-org/synapse I am running tox from the top level of the project. I get this error: exceptions.ImportError: No module named pymacaroons But pymacaroons is already installed using pip. To my knowledge, I only have one version of python. Really stumped here. 回答1: tox creates its own virtual environments and installs dependencies according to tox.ini . pymacaroons is not listed in tox.ini hence it's not

Unicode Error when running Flake8 test with TOX

雨燕双飞 提交于 2020-01-02 07:12:21
问题 I'm new to Tox and i want to set it up to run flake8 test on my project but i keep getting unicode error when i try to run tox. UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 76: ordinal not in range(128) This is a peek of my tox.ini file: [tox] envlist = flake8 [testenv:flake8] basepython = python2 skip_install = true deps = flake8 commands = flake8 -v # Flake8 Configuration [flake8] # Ignore some flake8-docstrings errors # NOTE(sigmavirus24): While we're still using

Does tox.ini need escaping for anchors in URLs (hash #)?

拈花ヽ惹草 提交于 2019-12-31 06:11:01
问题 I have a tox.ini like this [tox] skipsdist = True envlist = begin,py35,py36,end [testenv] commands = pip install -e git+ssh://git@bitbucket.org/org/repo#egg=repo[server] and I get the error Could not detect requirement name for 'git+ssh://git@bitbucket.org/org/repo.git', please specify one with #egg=your_package_name It looks very much as if the # is treated as a comment. Is that the case? How can I escape it? What I tried \# : The \ is recognized, but not the rest - so it is not an escape

Does tox.ini need escaping for anchors in URLs (hash #)?

孤街浪徒 提交于 2019-12-31 06:09:52
问题 I have a tox.ini like this [tox] skipsdist = True envlist = begin,py35,py36,end [testenv] commands = pip install -e git+ssh://git@bitbucket.org/org/repo#egg=repo[server] and I get the error Could not detect requirement name for 'git+ssh://git@bitbucket.org/org/repo.git', please specify one with #egg=your_package_name It looks very much as if the # is treated as a comment. Is that the case? How can I escape it? What I tried \# : The \ is recognized, but not the rest - so it is not an escape

“file not found” on travis-ci when running pytest from tox using docker

穿精又带淫゛_ 提交于 2019-12-25 00:43:16
问题 I'm trying to run my tests throught travis-ci, but i receive "file not found tests" error. When i run local with same command everything is ok, but in travis i receive this error. I think its because tests folder which in root of my project located somewhere in other directory - in directory where travis copy github repo. I try this settings in tox.ini but none of whem help: commands = py.test $TRAVIS_BUILD_DIR/tests {posargs} passenv = TRAVIS_BUILD_DIR commands = py.test $TRAVIS_BUILD_DIR