Unit test Maven style convention packages

I want to create a pybuilder project with unit tests and packages. For example, a modified simple python app , with "helloworld" moving to the "hello" package.

My first instinct was to map the package structure to the sources "main" and "unittest":

+---src +---main | \---python | \---hello | helloworld.py | __init__.py | \---unittest \---python \---hello helloworld_tests.py __init__.py 

This does not work due to an inconsistent hello package.

 BUILD FAILED - 'module' object has no attribute 'helloworld_tests' 

I see pybuilder itself just skipping the top-level pybuilder package in unittests, but it wonโ€™t do it if there are several top level packages.

My second assumption would be to create an additional top-level package for unittests.

 \---unittest \---python \---tests | __init__.py \---hello helloworld_tests.py __init__.py 

Is there a better solution or an established convention on how to organize python tests in packages?

+6
source share

All Articles