Skip to content
Snippets Groups Projects
Commit eb4286fd authored by Tristan Maat's avatar Tristan Maat
Browse files

WIP: Add tests

parent 357bb9da
No related branches found
No related tags found
No related merge requests found
Pipeline #43869748 failed
#
# 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")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment