Giter Site home page Giter Site logo

Ultest does nothing silently about vim-ultest HOT 3 OPEN

wookayin avatar wookayin commented on July 17, 2024
Ultest does nothing silently

from vim-ultest.

Comments (3)

wookayin avatar wookayin commented on July 17, 2024

There are two bugs around.

With the following test suite:

import sys
import pytest
class TestA:
  def testFoo(self):                             
    assert False
  def test_bar(self):       
    assert False

It can detect only one test method because the method is using camel-case naming convention:

✖ a_test.py
  ✖ TestA          
    ? test_bar     

which should be also detected, as in plain pytest runnre and in vim-test.

Also, when there is no test method detected in any either case, it should say informative some error message. Hope this helps. Or any message about progress -- e.g., test is running, has completed.

from vim-ultest.

wookayin avatar wookayin commented on July 17, 2024

For the first one, test pattern are specified in g:test#python#patterns (or g:ultest_patterns). This can be confirmed by checking:

echo ultest#adapter#get_patterns(CURRENT_FILE_NAME)

For python, we by default have test_ pattern, but this can be configured as follows:

let g:test#python#patterns = {
-    \ 'test': ['\v^\s*%(async )?def (test_\w+)'],
+    \ 'test': ['\v^\s*%(async )?def (test\w+)'],
     \ 'namespace': ['\v^\s*class (\w+)']
     \}  

It was not very obvious to figure out. It would be great to add some warning messages when no tests were detected, and/or execution of test operations.

from vim-ultest.

rcarriga avatar rcarriga commented on July 17, 2024

Hi thanks for looking into this.

For the first one, test pattern are specified in g:test#python#patterns (or g:ultest_patterns).

This is actually not correct, using g:ultest_patterns is purely for runners which do not use pattern matching and so ultest needs custom patterns to find them. vim-test will not use these patterns to find the tests and so there will be inconsistency.

Also, when there is no test method detected in any either case, it should say informative some error message. Hope this helps. Or any message about progress -- e.g., test is running, has completed.

I don't think is necessary since the summary already shows what has been detected. There is no further information that vim-ultest can show.

For your actual problem of camel case names, this has come up before and there's nothing vim-ultest can do as this is a vim-test problem (See #39 (comment)).

To demonstrate this is vim-test you can use this file

def test_a():
    assert True
    
def testB():
    assert False

and run :TestNearest on the last line. It will pass because it ran test_a.

from vim-ultest.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.