pytest-cpp icon indicating copy to clipboard operation
pytest-cpp copied to clipboard

marking cpp test targets.

Open aselus-hub opened this issue 10 years ago • 5 comments

Is there any way to mark tests (whether through ini, filename or otherwise) so that py.test -m=system_test or -m=unittest works with the tests?

aselus-hub avatar Oct 29 '15 20:10 aselus-hub

Not currently, but I'm open to suggestions. :smile:

What's your use case exactly?

nicoddemus avatar Oct 29 '15 20:10 nicoddemus

currently the use case would be to mark by feature set, types of tests and target module. i.e.: if i have a camera_lib .so being built from n classes, someone can run all the unittests for camera by running -m="unittest,camera_lib". Or someone can run all RPC interface tests that are marked as rpctest, endtoend and using_camera_lib. we have multiple test types/categories, these are just examples I brainstormed.

aselus-hub avatar Nov 02 '15 17:11 aselus-hub

I see, thanks. Out of curiosity, do you use Boost.Python or Google Tests?

One option which is straightforward would be to automatically mark tests with the name of their executable, so all tests collected from camera_lib would have a camera_lib mark. Do you have other suggestions on how you would like to add some other custom marks?

nicoddemus avatar Nov 04 '15 12:11 nicoddemus

Maybe if we could generate pytest (real) tests and each test would run the cpp test by command line then we could mark tests and have fixtures for them as well.

nrbnlulu avatar Apr 27 '23 12:04 nrbnlulu

@nrbnlulu at runtime you mean? That's a possibility, but would require a significant rewrite of the plugin.

nicoddemus avatar Apr 27 '23 20:04 nicoddemus