diff --git a/README.md b/README.md index b4e6dcb..cc39da1 100644 --- a/README.md +++ b/README.md @@ -23,10 +23,10 @@ then to run: ### Tools -Extensions(98) | Tools(59) +Extensions(98) | Tools(60) ----------:| ----- .* | [contents](http://pygments.org/) • metadata • [git_blame](https://git-scm.com/docs/git-blame) • [git_log](https://git-scm.com/docs/git-log) -.py | [python_syntax](https://en.wikipedia.org/wiki/Python_syntax_and_semantics) • [python_unittests](https://docs.python.org/3/library/unittest.html) • [pydoc](https://docs.python.org/3/library/pydoc.html) • [mypy](http://mypy-lang.org/) • [python_coverage](https://coverage.readthedocs.io/) • [pycodestyle](http://pycodestyle.pycqa.org/en/latest/) • [pydocstyle](http://www.pydocstyle.org/en/2.1.1/usage.html) • [pyflakes](https://pypi.org/project/pyflakes/) • [pylint](https://www.pylint.org/) • [python_gut](https://github.com/ahamilton/eris/blob/master/gut.py) • [python_modulefinder](https://docs.python.org/3/library/modulefinder.html) • [dis](https://docs.python.org/3/library/dis.html) • [python_mccabe](https://pypi.org/project/mccabe/) • [bandit](https://pypi.org/project/bandit/) +.py | [python_syntax](https://en.wikipedia.org/wiki/Python_syntax_and_semantics) • [python_unittests](https://docs.python.org/3/library/unittest.html) • [pytest](https://docs.pytest.org/en/latest/) • [pydoc](https://docs.python.org/3/library/pydoc.html) • [mypy](http://mypy-lang.org/) • [python_coverage](https://coverage.readthedocs.io/) • [pycodestyle](http://pycodestyle.pycqa.org/en/latest/) • [pydocstyle](http://www.pydocstyle.org/en/2.1.1/usage.html) • [pyflakes](https://pypi.org/project/pyflakes/) • [pylint](https://www.pylint.org/) • [python_gut](https://github.com/ahamilton/eris/blob/master/gut.py) • [python_modulefinder](https://docs.python.org/3/library/modulefinder.html) • [dis](https://docs.python.org/3/library/dis.html) • [python_mccabe](https://pypi.org/project/mccabe/) • [bandit](https://pypi.org/project/bandit/) .pl .pm .t | [perl_syntax](https://en.wikipedia.org/wiki/Perl) • [perldoc](http://perldoc.perl.org/) .p6 .pm6 | [perl6_syntax](https://rakudo.org/) .pod .pod6 | [perldoc](http://perldoc.perl.org/) @@ -40,7 +40,7 @@ Extensions(98) | Tools(59) .bash .sh .dash .ksh | [shellcheck](https://www.shellcheck.net/) .wasm | [wasm_validate](https://github.com/WebAssembly/wabt) • [wasm_objdump](https://github.com/WebAssembly/wabt) .pdf | [pdf2txt](https://github.com/pdfminer/pdfminer.six) -.html .htm | [html_syntax](http://www.html-tidy.org/) • [html2text](http://www.mbayer.de/html2text/) • [pandoc](https://pandoc.org/) • [elinks](http://elinks.cz/) +.html .htm | [html_syntax](http://www.html-tidy.org/) • [html2text](http://www.mbayer.de/html2text/) • [elinks](http://elinks.cz/) .yaml .yml | [yamllint](https://github.com/adrienverge/yamllint) .md .epub .docx .odt .rst | [pandoc](https://pandoc.org/) .zip .jar .apk .egg .whl | [zipinfo](http://www.info-zip.org/UnZip.html) diff --git a/eris/tools.py b/eris/tools.py index 14196fd..ecb6baa 100644 --- a/eris/tools.py +++ b/eris/tools.py @@ -278,6 +278,23 @@ def python_unittests(path): return Status.not_applicable, "No tests." +@deps(deps={"pip/pytest"}, url="https://docs.pytest.org/en/latest/", + executables={"pytest"}) +def pytest(path): + command = ["pytest", "--doctest-modules", "--color=yes", path] + process = subprocess.run(command, stdout=subprocess.PIPE, + stderr=subprocess.PIPE, text=True, + timeout=TIMEOUT) + stdout, stderr, returncode = ( + termstr.TermStr.from_term(process.stdout), + termstr.TermStr.from_term(process.stderr), process.returncode) + if returncode == 5: + status = Status.not_applicable + else: + status = Status.ok if returncode == 0 else Status.problem + return status, (stdout + stderr) + + @deps(url="https://docs.python.org/3/library/pydoc.html") def pydoc(path): stdout, stderr, returncode = _do_command( diff --git a/eris/tools.toml b/eris/tools.toml index 853c10e..c66a1eb 100644 --- a/eris/tools.toml +++ b/eris/tools.toml @@ -3,7 +3,7 @@ # Licensed under the Artistic License 2.0. tools_for_extensions = [ - [["py"], ["python_syntax", "python_unittests", "pydoc", "mypy", + [["py"], ["python_syntax", "python_unittests", "pytest", "pydoc", "mypy", "python_coverage", "pycodestyle", "pydocstyle", "pyflakes", "pylint", "python_gut", "python_modulefinder", "dis", "python_mccabe", "bandit"]],