asfaltboy / SublimeTestPlier

run python tests quickly from within a project
https://packagecontrol.io/packages/Test%20Plier
MIT License
10 stars 4 forks source link

Created the setting "run_last_valid_test": true, #22

Closed evandrocoan closed 6 years ago

evandrocoan commented 6 years ago

If you select and ran the test test_py on the class UnitTest and latter moved from the test file to the source code on the class MyClass on the function my_function. If you try to run the unit test, the plugin will end up running MyClass and my_function as unit tests. But it is invalid as they are not tests.

With this setting, when running individual Unit Tests, it will run the last function which had its name starting with test_ and not the current one named my_function.

(cherry picked from commit 73364a57f88e4f5f97461eb31e5db8ce48f37644)

asfaltboy commented 6 years ago

Thanks for the contribution @evandrocoan ; I like the idea of running the last test a lot!

That said, I think this pull-request should focus with caching the last test and running it if specific test target is selected. This feature should be toggle-able in settings.

In a separate PR, we can add settings for both class and method/func patterns to be matched against.

With these both PRs users will then be able to specify whether they want to skip certain func names and whether they would like the last ran test to be re-run when the no tests are selected.