Commit e579efb
authored
Wallet reorg, async helper test, drop dead MANIFEST.in / old_tests (#4)
Three independent cleanups bundled into one PR:
1. Move payment_address.{h,cpp} from chain/ to wallet/
The Knuth C-API has always had `kth/capi/wallet/payment_address.h`
under wallet/, not chain/. py-native carried the historical
misclassification. Move both the wrapper header and the wrapper
implementation to mirror the upstream layout:
include/kth/py-native/chain/payment_address.h
→ include/kth/py-native/wallet/payment_address.h
src/chain/payment_address.cpp
→ src/wallet/payment_address.cpp
Includes in src/module.c and src/wallet/payment_address.cpp,
plus the source list in setup.py, follow.
2. Salvage the async_exec helper from old_tests/, drop the rest
old_tests/ had two stale Python "tests" — really standalone
scripts, not pytest tests:
- test_native_py: 715 lines, of which the first ~165 dup the
printers in examples/settings.py, the main() duplicates the
node bootstrap covered by tests/test_node.py, and the last
~550 lines are commented-out JavaScript (a historical
reference catalog of API calls).
- test_native_async_py: 210 lines, mostly the same printers
again, but with a real gem hiding in the middle: an
async_exec() helper that wraps the kth_native callback API
(`callback(error, *result)`) into an awaitable via
asyncio.Future + call_soon_threadsafe. Idiomatic Python
bridge that downstream consumers (py-api) will want to copy.
Extract `async_exec` into a new `tests/test_node_async.py` and
delete old_tests/ entirely. The new file is a *unit* test of
the helper, not a node test: a single Python process can only
bootstrap one Knuth node (global logging/thread state from the
first node_construct/destruct doesn't reset, the second
construct trips on it), so we drive async_exec with three
synthetic callable shapes — inline callback, threaded callback,
error-path — and assert the bridge resolves correctly in each.
tests/test_node.py keeps covering the live-node path. No new
dependency: just `asyncio.run()` from a regular sync test, no
pytest-asyncio needed.
3. Delete MANIFEST.in (redundant + wrong)
setuptools-scm picks up every git-tracked file for the sdist
automatically. The MANIFEST.in we had was both redundant and
incorrect — it referenced version.py (deleted in the previous
PR), the old chain/payment_address.h location (moved by this
PR), nonexistent paths (chain/*.h, p2p/*.h, doc/, test/), and
build artifacts (*.so, *.dll, *.dylib) that have no business
in the sdist. Drop it. Verified the sdist still ships 111
files including tests/, examples/, kth_native.pyi, py.typed,
src/wallet/payment_address.cpp, and the include/wallet/
directory.
All 6 tests pass locally after the reorg.1 parent 206c98b commit e579efb
8 files changed
Lines changed: 104 additions & 957 deletions
File tree
- include/kth/py-native/wallet
- old_tests
- src
- wallet
- tests
This file was deleted.
File renamed without changes.
This file was deleted.
0 commit comments