
Research
PyPI Package Disguised as Instagram Growth Tool Harvests User Credentials
A deceptive PyPI package posing as an Instagram growth tool collects user credentials and sends them to third-party bot services.
pytest-node-dependency
Advanced tools
pytest-node-dependency is a pytest plugin that allows you to define dependencies between tests and reorder their execution based on those dependencies. This plugin ensures that tests with dependencies run after their required prerequisites have completed successfully.
A unique feature of the plugin is that if you set a test to depend on another one, the plugin will check if the test being depended upon failed. If that's the case, it will mark the current test as 'expected to fail' (xfail).
pip install pytest-node-dependency
To set up a test dependency, decorate the test function with the depends
mark and provide a list of dependencies via the on
keyword argument to the decorator. Dependencies can be specified by name only when in the same file as the test being decorated or by the pytest node path for tests in other files/classes.
import pytest
def test_second(request):
print("second")
assert request.session.items[1].name == 'test_second'
@pytest.mark.depends(on=["test_plugin.py::test_second"])
def test_last(request):
print("last")
assert request.session.items[2].name == 'test_last'
def test_first(request):
print("first")
assert request.session.items[0].name == 'test_first'
The way xdist plugin works is by utilizing multiple cores and spreads the tests among them. The problem with the plugin is that if you wish to use reordering, you probably want to set some dependency among the tests, However, the xdist plugin will break it.
For that, you should set the group for the tests. The group means that a gateway worker will collect the tests, and will place all the grouped tests in a single gateway worker. This will lead creation of serial testing among parallel exectuion.
import pytest
@pytest.mark.depends(xdist_group='a')
def test_second(request):
print("second")
assert request.session.items[1].name == 'test_second'
@pytest.mark.depends(on=["test_plugin.py::test_second"], xdist_group='a')
def test_last(request):
print("last")
assert request.session.items[2].name == 'test_last'
def test_first(request):
print("first")
assert request.session.items[0].name == 'test_first'
FAQs
pytest plugin for controlling execution flow
We found that pytest-node-dependency 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
A deceptive PyPI package posing as an Instagram growth tool collects user credentials and sends them to third-party bot services.
Product
Socket now supports pylock.toml, enabling secure, reproducible Python builds with advanced scanning and full alignment with PEP 751's new standard.
Security News
Research
Socket uncovered two npm packages that register hidden HTTP endpoints to delete all files on command.