Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
|PyPI pyversions| |PyPI license| |PyPI version| |CircleCI build| |Codecov result|
.. |PyPI version| image:: https://img.shields.io/pypi/v/pytest-select.svg :target: https://pypi.org/project/pytest-select/ .. |PyPI license| image:: https://img.shields.io/pypi/l/pytest-select.svg :target: https://pypi.python.org/pypi/pytest-select/ .. |PyPI pyversions| image:: https://img.shields.io/pypi/pyversions/pytest-select.svg :target: https://pypi.python.org/pypi/pytest-select/ .. |CircleCI build| image:: https://img.shields.io/circleci/project/github/ulope/pytest-select/master.svg?logo=circleci :target: https://circleci.com/gh/ulope/pytest-select/ .. |Codecov result| image:: https://img.shields.io/codecov/c/github/ulope/pytest-select/master.svg?logo=codecov :target: https://codecov.io/gh/ulope/pytest-select
This is a pytest
_ plugin which allows to (de-)select tests by name from a list loaded from a file.
.. _pytest: https://pytest.org
It's recommended to install this package from PyPI::
pip install pytest-select
This plugin adds new command line options to pytest:
--select-from-file
--deselect-from-file
--select-fail-on-missing
The first two both expect an argument that resolves to a UTF-8 encoded text file containing one test name per line.
The third one changes the behaviour in case (de-)selected test names are missing from the to-be executed tests.
By default a warning is emitted and the remaining selected tests are executed as normal.
By using the --select-fail-on-missing
flag this behaviour can be changed to instead abort execution in that case.
Test names are expected in the same format as seen in the output of
pytest --collect-only --quiet
for example.
Both plain test names or complete node ids (e.g. test_file.py::test_name
) are accepted.
Example::
$~ cat selection.txt
test_something
test_parametrized[1]
tests/test_foo.py::test_other
$~ pytest --select-from-file selection.txt
$~ pytest --deselect-from-file selection.txt
This package uses Poetry_. To setup a development environment install Poetry and then run::
poetry install
.. _Poetry: https://poetry.eustace.io
Why not use pytest's builtin -k
option
The -k
selection mechanism is (currently) unable to deal with selecting multiple parametrized
tests and is also a bit fragile since it matches more than just the test name.
Additionally, depending on the number of tests, giving test names on the command line can overflow
the maximum command length.
What is this useful for
The author uses this plugin to split tests across workers
_ on Circle CI
_.
Example::
pytest --collect-only --quiet | \
grep '::' | \
circleci tests split --split-by=timings --timings-type=testname > selected.txt
pytest --select-from-file selected.txt
.. _Circle CI: https://circleci.com .. _split tests across workers: https://circleci.com/docs/2.0/parallelism-faster-jobs/#splitting-test-files
v0.1.2
- 2019-01-18:
v0.1.1
- 2018-12-10:
--select-fail-on-missing
optionv0.1.0post0
- 2018-12-08:
v0.1.0
- 2018-12-08:
FAQs
A pytest plugin which allows to (de-)select tests from a file.
We found that pytest-select demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.