UCL / GreatCMakeCookOff

Bunch of CMake pain in the baker

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

py.test file name pattern

fredRos opened this issue · comments

Why are files that I explicitly add ignored as they don't match a certain pattern? What's the point of explicitly naming the files? For example

add_pytest("${CMAKE_CURRENT_SOURCE_DIR}/tests.py"

is silently ignored because in https://github.com/UCL/GreatCMakeCookOff/blob/master/scripts/AddPyTest.cmake#L90

if("${filename}" MATCHES "^tests?_.*\\.py")
...
add_test(NAME ${testname}
            WORKING_DIRECTORY ${working_directory}
            COMMAND ${executable} ${filename} ${pytests_CMDLINE}
 )
 endif()

I suggest removing the pattern test. At the very least, this behavior should be documented properly in the wiki
https://github.com/UCL/GreatCMakeCookOff/wiki/Adding-py.test-to-ctest

Apart from that, I just started using cmake and it seems you put together an impressive collection of useful stuff that could be useful for my future projects. And I know that documenting all that is much less fun that writing/using the code :)

Thanks for the kind words.
I'm pushing a fix so tests.py is accepted as a test file (it should be). Note that most testing frameworks expect the name of test files to follow a certain pattern, so we'll stick to that here as well.

Other files can be included, however they are meant to contain fixtures and helper functions for the tests, rather than tests themselves.

Yes, it thoroughly undocumented :(