Skip to content
Snippets Groups Projects

Make one ctest per one py file with pytests

Closed Michal Mazurek requested to merge mimazure/Gaudi:mimazure-pytests-one-per-file into master
2 unresolved threads

@clemenci @gcorti @admorris

Currently we have one ctest for all the pytest in one package. This will change this behaviour to have one ctest per one .py file with pytests in it, so that this is similar to what we have for qmt tests.

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • 726 726 if(NOT test_directory)
    727 727 set(test_directory "${CMAKE_CURRENT_SOURCE_DIR}/tests/pytest")
    728 728 endif()
    729 get_filename_component(name "${test_directory}" NAME)
    730 add_test(NAME ${package_name}.${name}
    731 COMMAND run $<TARGET_FILE:pytest> -v --doctest-modules ${test_directory})
    732 set_tests_properties(${package_name}.${name} PROPERTIES LABELS "${PROJECT_NAME};${package_name}")
    729 file(GLOB_RECURSE pytest_files RELATIVE "${test_directory}" "${test_directory}/*.py") # ordered lexicographically
    • pytest is a bit more clever than that: it only takes tests from files called test_*.py or *_test.py (see the doc).

      With this approach you may try to run non-test files as test (not really a problem, but a waste of time and a bit confusing).

      It might be better to use pytest --collect-only and parse the output.

    • Please register or sign in to reply
  • Michal Mazurek added 1 commit

    added 1 commit

    • e0e506ec - Apply 1 suggestion(s) to 1 file(s)

    Compare with previous version

  • Marco Clemencic changed milestone to %v36r12

    changed milestone to %v36r12

  • Edited by Software for LHCb
  • Marco Clemencic changed milestone to %v36r13

    changed milestone to %v36r13

  • Marco Clemencic mentioned in merge request !1440 (merged)

    mentioned in merge request !1440 (merged)

  • I think this can be closed in favour of !1440 (merged)

  • closed

  • Please register or sign in to reply
    Loading