From fdcc6571045c6c6a6c7bd4b96663d330f7406c14 Mon Sep 17 00:00:00 2001 From: maltekliemann Date: Fri, 13 Aug 2021 21:40:10 +0200 Subject: [PATCH] Fix snapshot test --- resources/example_mock.h | 2 +- tests/test_commandline.py | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/resources/example_mock.h b/resources/example_mock.h index 2f1bd5f..09a7a83 100644 --- a/resources/example_mock.h +++ b/resources/example_mock.h @@ -3,7 +3,7 @@ #define DRMOCK #include -#include "/Users/malte/drmock-generator/resources/example.h" +#include "@PATH@" namespace outer { namespace inner { namespace ns { diff --git a/tests/test_commandline.py b/tests/test_commandline.py index 8a7242e..be517c6 100644 --- a/tests/test_commandline.py +++ b/tests/test_commandline.py @@ -13,6 +13,7 @@ def test_snapshot(script_runner): + PATH = "resources/example.h" with tempfile.TemporaryDirectory() as tmpdir: path = os.path.join(tmpdir, "example_mock.h") ret = script_runner.run( @@ -21,7 +22,7 @@ def test_snapshot(script_runner): "Derived", "--output-class", "DerivedMock", - "resources/example.h", + PATH, str(path), "-n", "ns", @@ -31,8 +32,9 @@ def test_snapshot(script_runner): ) with open(path, "r") as f: result = f.read() - with open("resources/example_mock.h") as f: - expected = f.read() + with open("resources/example_mock.h") as f: + expected = f.read() + expected = expected.replace("@PATH@", os.path.abspath(PATH)) assert ret.success assert result == expected