From 73b930024d164e076275868253f92a47593f2dd8 Mon Sep 17 00:00:00 2001 From: Tristan Van Berkom Date: Sun, 17 Jun 2018 21:04:41 -0400 Subject: doc: Adding part 2 of the getting started tutorial o doc/examples/running-commands: New example project of a `manual` build element o doc/sessions/running-commands.run: New session file to capture bst output o doc/source/sessions-stored: Added new generated sessions o doc/source/tutorial/running-commands.rst: New tutorial entry describing how commands are run in the sandbox o tests/examples/running-commands.py: Test case validating the tutorial's assertions --- tests/examples/running-commands.py | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 tests/examples/running-commands.py (limited to 'tests/examples/running-commands.py') diff --git a/tests/examples/running-commands.py b/tests/examples/running-commands.py new file mode 100644 index 000000000..95f645d77 --- /dev/null +++ b/tests/examples/running-commands.py @@ -0,0 +1,36 @@ +import os +import pytest + +from tests.testutils import cli_integration as cli +from tests.testutils.integration import assert_contains +from tests.testutils.site import IS_LINUX + + +pytestmark = pytest.mark.integration +DATA_DIR = os.path.join( + os.path.dirname(os.path.realpath(__file__)), '..', '..', 'doc', 'examples', 'running-commands' +) + + +@pytest.mark.skipif(not IS_LINUX, reason='Only available on linux') +@pytest.mark.datafiles(DATA_DIR) +def test_running_commands_build(cli, tmpdir, datafiles): + project = os.path.join(datafiles.dirname, datafiles.basename) + checkout = os.path.join(cli.directory, 'checkout') + + result = cli.run(project=project, args=['build', 'hello.bst']) + assert result.exit_code == 0 + + +# Test running the executable +@pytest.mark.skipif(not IS_LINUX, reason='Only available on linux') +@pytest.mark.datafiles(DATA_DIR) +def test_running_commands_run(cli, tmpdir, datafiles): + project = os.path.join(datafiles.dirname, datafiles.basename) + + result = cli.run(project=project, args=['build', 'hello.bst']) + assert result.exit_code == 0 + + result = cli.run(project=project, args=['shell', 'hello.bst', '--', 'hello']) + assert result.exit_code == 0 + assert result.output == 'Hello World\n' -- cgit v1.2.1