
Research
Security News
The Growing Risk of Malicious Browser Extensions
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
.. image:: https://travis-ci.org/benemery/pyguard.svg?branch=master :target: https://travis-ci.org/benemery/pyguard
.. image:: https://coveralls.io/repos/benemery/pyguard/badge.svg?branch=master :target: https://coveralls.io/r/benemery/pyguard?branch=master
A python auto test runner inspired by the guard <https://github.com/guard/guard>
_ project.
A simple example that runs all the tests when a file is modified would look something like this:
.. code-block:: python
from filewatch import file_updated_subject, Watcher
from pyguard import guardian, GuardianObserver, RegexRule, RuleManager
manager = RuleManager(cmd='py.test pyguard')
manager.register_rules(
RegexRule(regex=r'.*/pyguard/.*'),
)
guardian.register_manager(manager)
# Set up our file observer
file_updated_subject.register_observer(GuardianObserver())
# Get our watcher going
watcher = Watcher()
watcher.run()
Any RuleManager
that you create will execute the given command whenever a registered rule matches a supplied file path.
To make things a little more granular, we can register a different set of rules. i.e.
.. code-block:: python
...
manager = RuleManager(cmd='py.test pyguard/tests/test_{test_name}.py')
manager.register_rules(
RegexRule(regex=r'.*/rules.py', cmd_augmentation={'test_name' : 'rules'}),
RegexRule(regex=r'.*/core.py', cmd_augmentation={'test_name' : 'guardian'}),
)
guardian.register_manager(manager)
...
To enforce a particular naming convention we can take things even further using named groups within the regex itself. If we have say a views.py
and we know that the tests for said views exist in test_views.py
, then we can simple use:
.. code-block:: python
...
manager = RuleManager(cmd='py.test pyguard/tests/test_{test_name}.py')
manager.register_rules(
RegexRule(regex=r'.*/(?P<test_name>views).py'),
)
guardian.register_manager(manager)
...
FAQs
Python auto test runner
We found that pyguard 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
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
Research
Security News
An in-depth analysis of credential stealers, crypto drainers, cryptojackers, and clipboard hijackers abusing open source package registries to compromise Web3 development environments.
Security News
pnpm 10.12.1 introduces a global virtual store for faster installs and new options for managing dependencies with version catalogs.