Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Future #5

Open
dc-avasilev opened this issue Jul 11, 2018 · 5 comments
Open

Future #5

dc-avasilev opened this issue Jul 11, 2018 · 5 comments

Comments

@dc-avasilev
Copy link

dc-avasilev commented Jul 11, 2018

Привет, добавь плз в список доступных переменных переменую ${selectedText}
очень не хватает такого функционала, хочется использовать ее для запуска конкретных тестов для другова фрэймворка, было бы просто супер, заранее спасибо.

пример использования:

"runCurrentTest.run": ". ${workspaceRoot}/.venv/bin/activate; pytest ${relativeTestPath}::${selectedText}"
@asvetliakov
Copy link
Owner

Никогда бы не подумал что можно использовать для запуска тестов не на JS. ОК, сделаю. Можно еще полностью вытягивать строку в пределах кавычек когда селекшина нету, или один символ.

@dc-avasilev
Copy link
Author

если вытягивать слово между разделителями: кавычки, пробелы и т.п. просто то слово на котором стоит указатель, тоже будет бомба!
Спасибо!

@dc-avasilev
Copy link
Author

dc-avasilev commented Jul 11, 2018

было бы еще круче если разделители можно было задать в настройках, к примеру для какой нибудь кастомной переменой типо:

CustomeSelectWordDelimeters: [
    " ",
    ",",
    "_"
]

${CustomeSelectWordDelimeters} - выделяет всю фразу или слово между указанными разделителями...

а если это все еще и будет с мультилайном работать и применятся для каждой мультикаретки, это просто жара будет!!! :)

@dc-avasilev
Copy link
Author

dc-avasilev commented Jul 11, 2018

а то просто для пайтеста функции на питоне называются типо:

def test_ololo():

поэтому было бы круто если можно было указать в разделителях " " и "(" и тогда поставить курсор на test|_ololo и запустив, запустился бы тест ${CustomeSelectWordDelimeters} = test_ololo

тип того :)

@asfaltboy
Copy link

asfaltboy commented Aug 6, 2019

Hey guys, I'm an author of a similar "extension" for python in sublime: asfaltboy/SublimeTestPlier. It is basically an AST parser for finding tests in python via sublime. The core functionality is in test_parser.py; it takes a given module and a line, and determines whether to run a specific test case, a class or the whole module. The plugin also supports passing the currently selected text as a test selector (e.g for pytest -k), as well as running the tests in an external shell (to allow input in tests, e.g line-by-line debugging).

The only thing I'm wondering about is how to use the setup environment's python to do the parsing 🤔 ... shall we collaborate on this? I'd love to integrate this functionality into vscode as well.

P.s: sorry for switching to english, I don't normally type in Russian so it's harder to express myself.

P.p.s: I just found that vscode uses the discovery command of python's built-in unittests OR pytest to discover the test cases: https://github.com/microsoft/vscode-python/blob/master/pythonFiles/testing_tools/adapter/__main__.py might be interesting to reuse this functionality?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants