Skip to content

Commit 8ffb245

Browse files
sshanenicoddemus
andauthored
Consider catch2's FAIL() (#147)
`pytest-cpp` was only considering the `REQUIRE` macro. Co-authored-by: Bruno Oliveira <[email protected]>
1 parent 0dedca1 commit 8ffb245

File tree

5 files changed

+24
-14
lines changed

5 files changed

+24
-14
lines changed

.github/workflows/deploy.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ jobs:
1616
SETUPTOOLS_SCM_PRETEND_VERSION: ${{ github.event.inputs.version }}
1717

1818
steps:
19-
- uses: actions/checkout@v3
19+
- uses: actions/checkout@v4.1.7
2020

2121
- name: Build and Check Package
22-
uses: hynek/build-and-inspect-python-package@v1.5
22+
uses: hynek/build-and-inspect-python-package@v2.9.0
2323

2424
deploy:
2525
needs: package
@@ -30,10 +30,10 @@ jobs:
3030
contents: write # For tag and release notes.
3131

3232
steps:
33-
- uses: actions/checkout@v3
33+
- uses: actions/checkout@v4.1.7
3434

3535
- name: Download Package
36-
uses: actions/download-artifact@v3
36+
uses: actions/download-artifact@v4.1.8
3737
with:
3838
name: Packages
3939
path: dist

.github/workflows/test.yml

+9-9
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ jobs:
2525
gtest_ver: [ "1.11.0" ]
2626

2727
steps:
28-
- uses: actions/checkout@v1
28+
- uses: actions/checkout@v4.1.7
2929
- name: Set up Python
30-
uses: actions/setup-python@v1
30+
uses: actions/setup-python@v5.2.0
3131
with:
3232
python-version: "3.8"
3333
- name: Install GoogleTest
@@ -49,7 +49,7 @@ jobs:
4949
pip install scons
5050
scons -j4 -C tests
5151
- name: Upload compilation results
52-
uses: actions/upload-artifact@v2
52+
uses: actions/upload-artifact@v4.4.0
5353
with:
5454
name: tests
5555
if-no-files-found: error
@@ -64,9 +64,9 @@ jobs:
6464
package:
6565
runs-on: ubuntu-latest
6666
steps:
67-
- uses: actions/checkout@v3
67+
- uses: actions/checkout@v4.1.7
6868
- name: Build and Check Package
69-
uses: hynek/build-and-inspect-python-package@v1.5
69+
uses: hynek/build-and-inspect-python-package@v2.9.0
7070

7171
test:
7272
needs: [compile, package]
@@ -78,20 +78,20 @@ jobs:
7878
python: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
7979

8080
steps:
81-
- uses: actions/checkout@v2
81+
- uses: actions/checkout@v4.1.7
8282
- name: Set up Python
83-
uses: actions/setup-python@v2
83+
uses: actions/setup-python@v5.2.0
8484
with:
8585
python-version: ${{ matrix.python }}
8686

8787
- name: Download compiled tests
88-
uses: actions/download-artifact@v3
88+
uses: actions/download-artifact@v4.1.8
8989
with:
9090
name: tests
9191
path: tests
9292

9393
- name: Download Package
94-
uses: actions/download-artifact@v3
94+
uses: actions/download-artifact@v4.1.8
9595
with:
9696
name: Packages
9797
path: dist

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# UNRELEASED
2+
3+
- Catch2: recognize `FAIL()` calls ([#147](https://github.com/pytest-dev/pytest-cpp/pull/147)).
4+
15
# 2.5.0 (2023-11-01)
26

37
- Catch2: add support for catch version 3 ([#115](https://github.com/pytest-dev/pytest-cpp/pull/115)).

src/pytest_cpp/catch2.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,10 @@ def _parse_xml(
198198
fail_msg,
199199
)
200200
)
201+
# These two tags contain the same attributes and can be treated the same
201202
test_exception = test_case.findall(".//Exception")
202-
for exception in test_exception:
203+
test_failure = test_case.findall(".//Failure")
204+
for exception in test_exception + test_failure:
203205
file_name = exception.attrib["filename"]
204206
line_num = int(exception.attrib["line"])
205207

tests/catch2_failure.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ TEST_CASE( "Factorials are computed", "[factorial]" ) {
1313
REQUIRE( Factorial(10) == 3628800 );
1414
}
1515

16+
TEST_CASE( "Test fail macro" ) {
17+
FAIL("This is a fail");
18+
}
19+
1620
TEST_CASE( "Failed Sections" ) {
1721
SECTION( "failed 1" ) {
1822
REQUIRE(false);

0 commit comments

Comments
 (0)