Closed seblj closed 3 years ago
So I can't see how the camel case works with vim-test. The patterns used to find the test in vim-test (same in vim-ultest) is '\v^\s*%(async )?def (test_\w+)'
which wouldn't allow for camel case (test_\w+
). I've even looked at the code for django specifically and it is doing no sort of case conversion.
What I think is happening is that you are running the TestNearest
command which is picking up the test's parent class and running that instead. I'm not familiar at all with django so can't set up a project quickly, Could you create a test file with two camel case tests to see if they will run separately? Something like
from django.test import TestCase
class TestUltest(TestCase):
def testA(self):
assert False
def testB(self):
assert False
and tell me if you see both failed tests in the output of TestNearest
To your second question, there's no functionality to do that right, though I could certainly add it. Could you tell me what is the reason you'd like that?
If I run TestNearest in the test-file you mentioned, it ran both tests. None of the test were run if I tried to use UltestNearest or Ultest.
I have no reason to clear the icons other than I think it would look better if I am writing some more tests. Just personal preference really
OK so that confirms it. The tests are not running individually... This is an issue with vim-test then. vim-ultest can't run the tests individually if vim-test can't.
There's a few different avenues you can go down, since there's nothing I can do can change the behaviour of vim-test I'm afraid:
test
:
let test#python#patterns = {
\ 'test': ['\v^\s*%(async )?def (test\w+)'],
\ 'namespace': ['\v^\s*class (\w+)'],
\}
2. Open a PR to vim-test to either suggest the change above or the following to check the patterns don't exist so you can override in your own config with the above. This is easily done with the following code in `autoload/test/python.vim`
```vim
if !exists('g:test#python#patterns')
let test#python#patterns = {
\ 'test': ['\v^\s*%(async )?def (test_\w+)'],
\ 'namespace': ['\v^\s*class (\w+)'],
\}
endif
Okay thank you for checking this! I agree that I really should not use camel case, but in my defence, it was not me who named the test😂
Btw, could you add an option to clear the icons? Would really appreciate it!
Haha that's very fair, we all have to live with some sketchy code bases!
And yep can do, I will close this issue when it's in
Added a new command UltestClear
which will wipe all results from the current file.
Works great! Thanks!
Describe the bug Test won't run if name of test is in camelcase.
I am using djangotest as the python runner
To Reproduce Create a test, and name it with camelcase in a django project, and try to run it. For example: This won't run.
This will run
Expected behavior As it runs as expected with vim-test, I would expect it to be run with vim-ultest as well.
Also while I am here, I have a simple question as well: Is it possible to clear the icons after running tests? Couldn't figure out how to do this