I created a "Python: Copy Path For Pytest"
command, which, depending on the current cursor position, returns something like "mypackage.tests.test_module::TestClass.test_method"
and copies it to the clipboard. I then switch to my terminal and pass that string as an argument for pytest, e.g.
$ python3 -m pytest mypackage.tests.test_module::TestClass.test_method
This way I can run a specific (single) Python test.
Now, I would like to do something similar by using the build system instead. This way I can avoid switching back & forth from the Linux shell. Basically what I need is to tell the build system to interpret a custom $variable
. Something like:
{
"cmd": ["python3", "-m", "pytest", "$pytest_obj_path"],
"selector": "source.python",
}
Any idea on what’s the best way to accomplish this?
Thanks in advance