From a3f8643c272a35e7c6e79dff25bf2b54e03a3a21 Mon Sep 17 00:00:00 2001 From: Andrew Hamilton Date: Tue, 28 Jul 2026 10:18:09 +1000 Subject: [PATCH] Add conftest.py for --diff/--accept pytest options --- tests/conftest.py | 17 +++++++++++++++++ .../golden-files/results/readelf-rotatingtree_o | 2 ++ 2 files changed, 19 insertions(+) create mode 100644 tests/conftest.py diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 0000000..6e8ac24 --- /dev/null +++ b/tests/conftest.py @@ -0,0 +1,17 @@ +import sys +sys.path.insert(0, __file__.rsplit("/", 1)[0]) + +import golden + + +def pytest_addoption(parser): + parser.addoption("--diff", action="store_true", help="Show diff for golden file mismatches") + parser.addoption("--accept", action="store_true", help="Accept golden file changes") + + +def pytest_sessionfinish(session): + if golden._FAILED: + if session.config.getoption("--accept"): + golden._accept_actual(golden._FAILED) + if session.config.getoption("--diff"): + golden._show_differences(golden._FAILED) diff --git a/tests/golden-files/results/readelf-rotatingtree_o b/tests/golden-files/results/readelf-rotatingtree_o index 0f03f47..b225525 100644 --- a/tests/golden-files/results/readelf-rotatingtree_o +++ b/tests/golden-files/results/readelf-rotatingtree_o @@ -332,6 +332,8 @@ Symbol table '.symtab' contains 17 entries: No version information found in this file. +There is no GOT section in this file. + Displaying notes found in: .note.gnu.property Owner Data size Description GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0