tools: Add pytest for python unittests.
This commit is contained in:
parent
408f2de098
commit
2fb3696c9b
3 changed files with 21 additions and 4 deletions
|
|
@ -23,10 +23,10 @@ then to run:
|
||||||
|
|
||||||
### Tools
|
### 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)
|
.* | [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/)
|
.pl .pm .t | [perl_syntax](https://en.wikipedia.org/wiki/Perl) • [perldoc](http://perldoc.perl.org/)
|
||||||
.p6 .pm6 | [perl6_syntax](https://rakudo.org/)
|
.p6 .pm6 | [perl6_syntax](https://rakudo.org/)
|
||||||
.pod .pod6 | [perldoc](http://perldoc.perl.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/)
|
.bash .sh .dash .ksh | [shellcheck](https://www.shellcheck.net/)
|
||||||
.wasm | [wasm_validate](https://github.com/WebAssembly/wabt) • [wasm_objdump](https://github.com/WebAssembly/wabt)
|
.wasm | [wasm_validate](https://github.com/WebAssembly/wabt) • [wasm_objdump](https://github.com/WebAssembly/wabt)
|
||||||
.pdf | [pdf2txt](https://github.com/pdfminer/pdfminer.six)
|
.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)
|
.yaml .yml | [yamllint](https://github.com/adrienverge/yamllint)
|
||||||
.md .epub .docx .odt .rst | [pandoc](https://pandoc.org/)
|
.md .epub .docx .odt .rst | [pandoc](https://pandoc.org/)
|
||||||
.zip .jar .apk .egg .whl | [zipinfo](http://www.info-zip.org/UnZip.html)
|
.zip .jar .apk .egg .whl | [zipinfo](http://www.info-zip.org/UnZip.html)
|
||||||
|
|
|
||||||
|
|
@ -278,6 +278,23 @@ def python_unittests(path):
|
||||||
return Status.not_applicable, "No tests."
|
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")
|
@deps(url="https://docs.python.org/3/library/pydoc.html")
|
||||||
def pydoc(path):
|
def pydoc(path):
|
||||||
stdout, stderr, returncode = _do_command(
|
stdout, stderr, returncode = _do_command(
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
# Licensed under the Artistic License 2.0.
|
# Licensed under the Artistic License 2.0.
|
||||||
|
|
||||||
tools_for_extensions = [
|
tools_for_extensions = [
|
||||||
[["py"], ["python_syntax", "python_unittests", "pydoc", "mypy",
|
[["py"], ["python_syntax", "python_unittests", "pytest", "pydoc", "mypy",
|
||||||
"python_coverage", "pycodestyle", "pydocstyle", "pyflakes",
|
"python_coverage", "pycodestyle", "pydocstyle", "pyflakes",
|
||||||
"pylint", "python_gut", "python_modulefinder", "dis",
|
"pylint", "python_gut", "python_modulefinder", "dis",
|
||||||
"python_mccabe", "bandit"]],
|
"python_mccabe", "bandit"]],
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue