In creating new Singer Taps using the Meltano SDK, it's not always clear how to setup testing in VS Code.
What's the best way to get the VS Code test features working?
In creating new Singer Taps using the Meltano SDK, it's not always clear how to setup testing in VS Code.
What's the best way to get the VS Code test features working?
This method makes unit tests (pytest tests) easy to run in the VS Code "Tests" pane.
Prereqs:
poetry install at least once.Once the above are complete, the "tests" pane should populate with the list of unit tests and you'll have an option in the VS Code GUI to "Run" or "Debug" each test.
This method actually runs your tap and sends the output to target-json or a similar sample target.
Prereqs:
main to the bottom of your tap.py to make it invocable:
if __name__ == "__main__":
TapGoogleAnalytics.cli()
target-jsonl via pipx install target-jsonl or similar.Replace tap_foobar with the actual name of your tap's library and then paste this into VS Code's launch.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${workspaceRoot}/tap_foobar/tap.py",
"console": "integratedTerminal",
"args": ["--config", ".secrets/config.json", "|", "target-jsonl"],
"env": { "PYTHONPATH": "${workspaceRoot}"}
}
]
}