Package: tox-lambda-autodiscovery
tox-lambda-autodiscoveryAutodiscovery and autocreate tox testenv to aws lambda functionsThisPytestplugin was generated
withCookiecutteralong with@obestwalter'sCookiecutter-tox-plugintemplate.This project is not yet ready for production.FeaturesAutodiscovery and autocreate tox testenv to aws lambda function.TODO:rewrite code when tox api is more flexible:https://mail.python.org/mm3/archives/list/tox-dev@python.org/thread/2B2GXTFWCE6FYMVCMBMKAOQAXEOGXEWR/Write testsRequirementsPython >= 3.6, tox >= 3.3.0InstallationYou can installtox-lambda-autodiscoveryviapipfromPyPI:$ pip install tox-lambda-autodiscoveryor directly from github:$ pip install -e git+https://github.com/luzfcb/tox-lambda-autodiscovery@master#egg=tox-lambda-autodiscoveryUsageAdd a new section named[testenv:lambdaautodiscovery]ontox.ini.The plugin is active only when the section[testenv:lambdaautodiscovery]exists.Configuration options for[testenv:lambdaautodiscovery]search_dirsA list of directories that the plugin uses as autodiscover.The default value is{toxinidir}.ExampleHaving a list of directories, with subdirectories, which contains a filerequirements.txt, and a python file started withteston the same directory level: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.pyThesearch_base_dirslooks like the following:search_dirs=backend1backend2ignored_dirsDirectories that the plugin should ignore in autodiscovery.Exampleignored_dirs = .serverless
               .vscodeThe directories with the following names are ignored by default:.tox
__pycache__
eggs/
.eggs/
node_modulesIf you want to override the default ignored directories names, use the optiondefault_ignored_dir_names.thecommands_workaroundis a way to customize toxcommandseg.: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 ofcommandsThePYTHONPATHcan be customized by settingsetenv =
    PYTHONPATH = {toxinidir}/backend/Full sample config:the following directories structure:(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.iniThe configuration:[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/appsContributingContributions are very welcome. Tests can be run withtox, please ensure the coverage at least stays the same before you submit a pull request.LicenseDistributed under the terms of theMITlicense,tox-lambda-autodiscoveryis free and open source software.IssuesIf you encounter any problems, pleasefile an issuealong with a detailed description.