PyTest icon indicating copy to clipboard operation
PyTest copied to clipboard

Enhancement: Create test stubs

Open pykong opened this issue 5 years ago • 1 comments

I believe a great enhancement for this package would be a command to create test stubs. Such would parallel a function many IDEs, like Visual Studio, provide to make the life of the lazy programmer more comfortable.

app.py

def add(a: int, b: int) -> int:
    return a + b

Will create this test file under the respective path with some test stub already in it:

/tests/test_app.py

import pytest

from ..app import add

def test_add(self):
    """Test for add."""
    raise NotImplementedError("Test for add not implemented.")

pykong avatar May 20 '19 19:05 pykong

There is no 1-to-1 relationship between app code and testing code. There is also no established convention how we should organize tests in the python community.

Again, you need a very good idea to get this rolling.

kaste avatar May 21 '19 17:05 kaste