No code changes
Run your script or module with veyra-snap run. It watches the functions in your project while your program does what it always does.
Run your code. Get pytest tests.
veyra-snap watches your program run, records what each of your functions was given and what it returned or raised, and writes those real calls as ready-to-run pytest tests. A safety net for code without tests, in one command.
pip install veyra-snapv1.0.0 · Free · MIT · Python 3.9+ · No dependencies · Windows, macOS, Linux
$ veyra-snap run app.py # use your program as usual ◆ veyra-snap recorded 38 calls in 8 functions, 27 new cases shop.cart.discount 5 cases (1 raise) shop.cart.line_total 3 cases shop.cart.price 6 cases (2 raises) shop.cart.subtotal 4 cases shop.text.new_order_id 1 case changes between calls: no tests shop.text.order_number 4 cases shop.text.slugify 3 cases ! shop.text.write_receipt: 4 calls left out (an argument: StringIO values can't be written as source) $ veyra-snap write ✓ tests/test_snap_shop_cart.py 18 cases in 6 tests ✓ tests/test_snap_shop_text.py 7 cases in 2 tests ◆ veyra-snap wrote 25 test cases. Run them: pytest $ pytest 25 passed in 0.05s
Run your script or module with veyra-snap run. It watches the functions in your project while your program does what it always does.
Each argument and result is written as Python source and rebuilt to make sure it comes back the same, type for type, before it goes in a test.
If the same arguments ever give a different result (time, randomness, a database), the function gets no tests. Functions that only return None are skipped too.
Calls that raise become tests that expect that exception with that exact message, so a changed error is caught as well.
Plain parametrized pytest, one test per function, each case named after its call. Review it, commit it, edit what looks wrong.
The standard library, your installed packages, virtual environments and your tests are never recorded.
On Python 3.12+ it uses sys.monitoring: library code costs nothing, and a function stops being watched once it has 25 cases. Hot loops stay fast.
Every run adds new cases to .veyra-snap/ and veyra-snap write regenerates the files. It never touches a test file it didn’t write.
Pure Python, MIT licensed, nothing sent anywhere. Python 3.9 to 3.14 on Windows, macOS and Linux.
This is part of what veyra-snap wrote for the example shop. Change how discounts round, and these tests fail.
@pytest.mark.parametrize( "args, kwargs, expected", [ pytest.param((decimal.Decimal('24.00'), None), {}, decimal.Decimal('0'), id="discount(decimal.Decimal('24.00'), None)"), pytest.param((decimal.Decimal('38.00'), 'welcome10'), {}, decimal.Decimal('3.80'), id="discount(decimal.Decimal('38.00'), 'welcome10')"), pytest.param((decimal.Decimal('64.50'), 'VIP25'), {}, decimal.Decimal('16.13'), id="discount(decimal.Decimal('64.50'), 'VIP25')"), ], ) def test_discount(args, kwargs, expected): assert shop.cart.discount(*args, **kwargs) == expected @pytest.mark.parametrize( "args, kwargs, error, message", [ pytest.param((decimal.Decimal('24.00'), 'FREEBIE'), {}, ValueError, "unknown coupon 'FREEBIE'", id="discount(decimal.Decimal('24.00'), 'FREEBIE')"), ], ) def test_discount_raises(args, kwargs, error, message): with pytest.raises(error) as caught: shop.cart.discount(*args, **kwargs) assert str(caught.value) == message
veyra-snap run app.py runs your program and notes what each function in your project was given, and what it returned or raised.
Every value is rebuilt from source and compared. Values that can't be, and functions that change between calls, are left out, with the reason shown.
veyra-snap write turns the recordings into tests/test_snap_<module>.py. Run pytest, and commit the tests.
Record a block with with recording():, or mark the functions you care about with @snap. @snap costs nothing in normal runs; it records under veyra-snap run, inside recording(), or with VEYRA_SNAP=1.
Nested any way you like:
pip install veyra-snapveyra-snap run app.py, or veyra-snap run -m yourpackage.veyra-snap write, then pytest.The official package is pypi.org/project/veyra-snap, published by FlightCoders. The source, docs and changelog are on GitHub. For JavaScript, try Veyra Live Values, which shows console.log values next to your code, and Veyra Blast Radius, which runs only the tests your change affects.
Getting a safety net fast. Code without tests, a refactor you’re nervous about, a library whose behaviour you want to lock down: run it once under veyra-snap and you have regression tests for what it does today.
No. They record what your code does now, bugs included, so you notice when that changes. Read them, and fix what looks wrong; they’re a starting point you own.
No. veyra-snap run app.py (or run -m yourpackage) records everything. If you prefer, mark chosen functions with @snap, or record a block with "with recording():".
Those calls are left out, and veyra-snap tells you which ones and why. Everything that does go in a test has been rebuilt from its source and compared first.
Python 3.9 to 3.14. On 3.12+ recording uses sys.monitoring and records raised errors automatically; on 3.9 to 3.11 it uses sys.settrace, and errors are recorded for functions marked with @snap.
Yes. veyra-snap is free and open source under the MIT license, with no account and no telemetry. It’s made by FlightCoders, the team behind the Veyra editor.
Veyra Studio is a fast, free code editor with Python debugging, Live Server and Search Everywhere built in.