自动发现并自动创建aws lambda函数的tox testenv

tox-lambda-autodiscover的Python项目详细描述


毒性lambda自动发现

PyPI versionPython versionsSee Build Status on Travis CISee Build Status on AppVeyorCoverage Status

autodiscovery和autocreate tox testenv to aws lambda函数


这个Pytest插件是生成的 与Cookiecutter一起 @obestwalterCookiecutter-tox-plugin 模板。

该项目尚未准备好投入生产。

功能

自动发现和自动创建tox testenv到aws lambda函数。

待办事项:

要求

  • python>;=3.6,tox>;=3.3.0

安装

您可以通过PyPI中的pip安装tox-lambda-autodiscovery

$ pip install tox-lambda-autodiscovery

或者直接从github:

$ pip install -e git+https://github.com/luzfcb/tox-lambda-autodiscovery@master#egg=tox-lambda-autodiscovery

用法

tox.ini上添加名为[testenv:lambdaautodiscovery]的新节。

The plugin is active only when the section [testenv:lambdaautodiscovery] exists.

[testenv:lambdaautodiscovery]

的配置选项

search_dirs

插件用作自动发现的目录列表。默认值是{toxinidir}

示例

有一个目录列表,包含子目录,其中包含一个文件requirements.txt,以及在同一目录级别上以test开头的python文件:

project:
       README.md
       backend1/
              serverless.yml
              package.json
              node_modules/
              functionCreateRole/
                   create_role.py
                   requirements.txt
                   test_create_role.py
       backend2/
              serverless.yml
              package.json
              node_modules/
              functionCreateUser/
                   create_user.py
                   requirements.txt
                   test_create_user.py

search_base_dirs看起来如下:

search_dirs=backend1              backend2

ignored_dirs

插件在自动发现中应忽略的目录。

示例
ignored_dirs = .serverless
               .vscode

默认情况下,将忽略具有以下名称的目录:

.tox
__pycache__
eggs/
.eggs/
node_modules

If you want to override the default ignored directories names, use the option default_ignored_dir_names.

commands_workaround是一种定制tox的方法commands

例如:

commands_workaround = {posargs:pytest} --cov={current_toxenv_lambda_dir} --basetemp={envtmpdir}

is ugly, but, tox 3.3.0 api has no simple way to defer processing of commands

可以通过设置自定义PYTHONPATH

setenv =
    PYTHONPATH = {toxinidir}/backend/

完整示例配置:

以下目录结构:

(myproject) fabio@luzfcb:~/projects$ tree myproject -L 2
myproject
├── README.md
├── backend
│   ├── README.md
│   ├── .serverless
│   │     ├── serverless-state.json
│   │     ├── cloudformation-template-create-stack.json
│   │     ├── functionOne
│   │     │     ├── requirements
│   │     │     └── requirements.txt
│   │     ├── functionTwo
│   │     │     ├── requirements
│   │     │     └── requirements.txt
│   ├── functionOne
│   │     ├── function_one.py
│   │     ├── test_function_one.py 
│   │     └── requirements.txt
│   ├── functionTwo
│   │     ├── function_two.py
│   │     ├── test_function_two.py 
│   │     └── requirements.txt
│   ├── apps
│   │     └── configure_django
│   │     │     └── __init__.py
│   │     └── myapp
│   │           ├── __init__.py
│   │           ├── apps.py
│   │           ├── models.py
│   │           └── migrations
│   └── serverless.yml
├── buildspec.yaml
├── cloudformation
│   └── dev-resources.yaml
├── codecov.yml
├── requirements.txt
├── requirements_dev.txt
├── setup.cfg
├── testspec.yaml
└── tox.ini

配置:

[testenv:lambdaautodiscovery]
commands_workaround = {posargs:pytest} --cov-append --cov={current_toxenv_lambda_dir} --basetemp={envtmpdir}

ignored_dirs = .serverless

search_dirs = backend

setenv =
    PYTHONPATH = {toxinidir}/backend/apps

贡献

我们非常欢迎您的贡献。可以使用tox运行测试,请确保在提交请求之前覆盖率至少保持不变。

许可证

根据MIT许可证的条款发布,tox-lambda-autodiscovery是免费的开源软件。

问题

如果您遇到任何问题,请file an issue连同详细说明。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java计算器没有正确执行Bodma   java Make按钮只有在变量达到某个值时才可见,并且不起作用   java VF2子图同构   mysql数据库中的Java存储操作   java递归如何只在最后执行操作   java如何用HibernateXML文件映射字符串列表   java如何使用Maven导入Confluence API?   内存增加java堆大小,在windows中使用eclipse   安卓 Java字符串。replaceAll返回不同的结果   java如何将安全补丁放在文本视图上?   java如何使用Exchange Web服务(EWS)修复客户端协议异常   java单元数组方法返回   java如何在我的HealthIndicator返回时强制服务器发回HTTP错误500   java DateFormat到DateTimeFormatter   如何在java中将日历设置为特定的日期和时间   java获取字符串格式的相对日期时间   java Maven项目迁移STS v4   从一台服务器到另一台服务器的java POST请求