From eb4286fdc858630eb2d446ed698ec81e9b26ad23 Mon Sep 17 00:00:00 2001
From: Tristan Maat <tm@tlater.net>
Date: Fri, 18 Jan 2019 11:59:51 +0000
Subject: [PATCH] WIP: Add tests

---
 tests/integration/messages.py | 70 +++++++++++++++++++++++++++++++++++
 1 file changed, 70 insertions(+)
 create mode 100644 tests/integration/messages.py

diff --git a/tests/integration/messages.py b/tests/integration/messages.py
new file mode 100644
index 0000000000..7f5caa91c1
--- /dev/null
+++ b/tests/integration/messages.py
@@ -0,0 +1,70 @@
+#
+#  Copyright (C) 2018 Codethink Limited
+#
+#  This program is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU Lesser General Public
+#  License as published by the Free Software Foundation; either
+#  version 2 of the License, or (at your option) any later version.
+#
+#  This library is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#  Lesser General Public License for more details.
+#
+#  You should have received a copy of the GNU Lesser General Public
+#  License along with this library. If not, see <http://www.gnu.org/licenses/>.
+#
+#  Authors: Tristan Maat <tristan.maat@codethink.co.uk>
+#
+
+import os
+import pytest
+
+from buildstream import _yaml
+
+from test.testutils import cli_integration as cli
+
+
+pytestmark = pytest.mark.integration
+
+
+# Project directory
+DATA_DIR = os.path.join(
+    os.path.dirname(os.path.realpath(__file__)),
+    "project",
+)
+
+
+@pytest.mark.integration
+@pytest.mark.datafiles(DATA_DIR)
+def test_disable_message_lines(cli, tmpdir, datafiles):
+    project = os.path.join(datafiles.dirname, datafiles.basename)
+    element_path = os.path.join(project, 'elements')
+    element_name = 'message.bst'
+
+    element = {
+        'kind': 'manual',
+        'depends': [{
+            'filename': 'base.bst'
+        }],
+        'config': [
+            {'build-commands':
+             ['echo "Silly message"'],
+             'strip-commands': []
+            }
+        ]
+    }
+
+    os.makedirs(os.path.dirname(os.path.join(element_path, element_name)), exist_ok=True)
+    _yaml.dump(element, os.path.join(element_path, element_name))
+
+    # First we check that we get the "Silly message"
+    result = cli.run(project=project, args=["build", element_name])
+    assert result.exit_code == 0
+    assert result.stderr.contains("Silly message")
+
+    # Let's now build it again, but with --message-lines 0
+    result = cli.run(project=project, args=["--message-lines 0",
+                                            "build", element_name])
+    assert result.exit_code == 0
+    assert not result.stderr.contains("Silly message")
-- 
GitLab