|
5 | 5 | from pytest_cpp.boost import BoostTestFacade |
6 | 6 | from pytest_cpp.error import CppTestFailure, CppFailureRepr |
7 | 7 | from pytest_cpp.google import GoogleTestFacade |
| 8 | +from distutils.spawn import find_executable |
8 | 9 |
|
9 | 10 |
|
10 | 11 | def assert_outcomes(result, expected_outcomes): |
@@ -390,6 +391,21 @@ def test_argument_option_priority(testdir, exes): |
390 | 391 | assert_outcomes(result, [("ArgsTest.one_argument", "passed")]) |
391 | 392 |
|
392 | 393 |
|
| 394 | +@pytest.mark.skipif( |
| 395 | + not find_executable("valgrind") or not find_executable("catchsegv"), |
| 396 | + reason="Environment does not have required tools", |
| 397 | +) |
| 398 | +def test_google_cpp_harness_via_option(testdir, exes): |
| 399 | + result = testdir.inline_run( |
| 400 | + exes.get("gtest"), |
| 401 | + "-k", |
| 402 | + "FooTest.test_success", |
| 403 | + "-o", |
| 404 | + "cpp_harness=catchsegv valgrind --tool=memcheck", |
| 405 | + ) |
| 406 | + assert_outcomes(result, [("FooTest.test_success", "passed")]) |
| 407 | + |
| 408 | + |
393 | 409 | def test_boost_one_argument(testdir, exes): |
394 | 410 | testdir.makeini( |
395 | 411 | """ |
@@ -428,6 +444,22 @@ def test_boost_two_arguments_via_option(testdir, exes): |
428 | 444 | assert_outcomes(result, [("boost_two_arguments", "passed")]) |
429 | 445 |
|
430 | 446 |
|
| 447 | +@pytest.mark.skipif( |
| 448 | + not find_executable("valgrind") or not find_executable("catchsegv"), |
| 449 | + reason="Environment does not have required tools", |
| 450 | +) |
| 451 | +def test_boost_cpp_harness_via_option(testdir, exes): |
| 452 | + result = testdir.inline_run( |
| 453 | + exes.get("boost_success"), |
| 454 | + "-s", |
| 455 | + "-k", |
| 456 | + "boost_success", |
| 457 | + "-o", |
| 458 | + "cpp_harness=catchsegv valgrind --tool=memcheck", |
| 459 | + ) |
| 460 | + assert_outcomes(result, [("boost_success", "passed")]) |
| 461 | + |
| 462 | + |
431 | 463 | def test_passing_files_directly_in_command_line(testdir, exes): |
432 | 464 | f = exes.get("boost_success") |
433 | 465 | result = testdir.runpytest(f) |
|
0 commit comments