def handler(self): notice = sns() hnd = CheckRun('zen of python', 'this', '1', '2', '3') subject, message = check_run_event() notice['Records'][0]['Sns']['Subject'] = subject notice['Records'][0]['Sns']['Message'] = message hnd.event = notice hnd.hook = json.loads(message) hnd._session = requests.Session() return hnd
def test_as_handler(self, handler): hdl = CheckRun.as_handler('zen of python', 'this', '1', '2', '3') assert callable(hdl) assert hdl.__name__ == 'CheckRun' with pytest.raises(ValueError): hdl(handler.event, {})
def handler(self): return CheckRun("black", "black", "--check", "--diff", "tests")
"""Lambda function that executes pyflakes, a static file linter.""" from lintipy import CheckRun handle = CheckRun.as_handler('pyflakes', 'pyflakes', '.')
def test_init(self): hnd = CheckRun('zen of python', 'this', '1', '2', '3') assert hnd.label == 'zen of python' assert hnd.cmd == 'this' assert hnd.cmd_args == ('1', '2', '3')
def handle(*args, **kwargs): """Handle that is invoked by AWS lambda.""" CheckRun( '{{cookiecutter.linter}}', '{{cookiecutter.command}}', '{{cookiecutter.directory}}' )(*args, **kwargs)
"""Lambda function that executes isort, a static file linter.""" from lintipy import CheckRun handle = CheckRun.as_handler('isort', 'isort', '--check-only', '--diff', '.')
"""Lambda function that executes bandit, a static file linter.""" from lintipy import CheckRun handle = CheckRun.as_handler( 'bandit', 'bandit.cli.main', '-r', '.' )
"""Lambda function that executes pydocstyle, a static file linter.""" from lintipy import CheckRun handle = CheckRun.as_handler('pydocstyle', 'pydocstyle', '.')
"""Lambda function that executes flake8, a static file linter.""" from lintipy import CheckRun handle = CheckRun.as_handler('flake8', 'flake8', '--jobs', '1', '.')
"""Lambda function that executes pycodestyle, a static file linter.""" from lintipy import CheckRun handle = CheckRun.as_handler('pycodestyle', 'pycodestyle', '.', )