PyGuard
A python auto test runner inspired by the guard project.
A simple example that runs all the tests when a file is modified would look something like this:
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.
...
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:
...
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)
...
Metadata
Release files for pyguard 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyguard-0.0.4.tar.gz | 2.7 kB | Without provenance | Details for pyguard-0.0.4.tar.gz |
Release files / pyguard-0.0.4.tar.gz
| Download URL | pyguard-0.0.4.tar.gz |
|---|---|
| Size | 2.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
79af61547dae5ee8338f2a961349c9fa54bd8be5a4597195da72b344253e680f
|
|
BLAKE2b-256 checksum How to use checksums |
f1b5b130b4447deeb35fe0b53f36fffe4450a2b54ef8f96a36f72a461824155c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for pyguard 0.0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.