moremoban / pypi-mobans

general python package templates using moban
Other
6 stars 7 forks source link

Support colocated unit tests #78

Open jayvdb opened 5 years ago

jayvdb commented 5 years ago

See https://github.com/ryanhiebert/backports.csv/pull/33#issuecomment-471327714

As I understand it, @ryanhiebert wants foo/config.py to be tested by foo/test_config.py , and the tests to be included in the sdist, but not be included in the wheel.

I suspect this is probably possible to be done using stock setuptools with a custom py_modules that includes every module, and a MANIFEST.in which finds all of the tests.

ryanhiebert commented 5 years ago

That's the basic idea, although I name the test file more like foo/config_test.py to allow the two files to be next to each other in my file browser. If there were a good way to have the unittests in the same file, the way rust does, I'd also be interested in that. The closer to the code it's testing, the better, basically.

chfw commented 5 years ago

I am on react side too. It does allow me to find test quicker.