diff options
author | Chandan Singh <csingh43@bloomberg.net> | 2019-11-05 13:00:30 +0000 |
---|---|---|
committer | Chandan Singh <csingh43@bloomberg.net> | 2019-11-05 13:00:30 +0000 |
commit | e06c2295b063245dbdb2397e5bd8c4d0a79ba10d (patch) | |
tree | 224a111e1daee5a7d450e7d5e0c31fd94c1e19c6 /tests/examples | |
parent | c1f423f8653c5a9e3e72283879e8cecabf25ed3f (diff) | |
download | buildstream-e06c2295b063245dbdb2397e5bd8c4d0a79ba10d.tar.gz |
Blacken codebase
Diffstat (limited to 'tests/examples')
-rw-r--r-- | tests/examples/autotools.py | 66 | ||||
-rw-r--r-- | tests/examples/developing.py | 91 | ||||
-rw-r--r-- | tests/examples/first-project.py | 20 | ||||
-rw-r--r-- | tests/examples/flatpak-autotools.py | 71 | ||||
-rw-r--r-- | tests/examples/integration-commands.py | 41 | ||||
-rw-r--r-- | tests/examples/junctions.py | 62 | ||||
-rw-r--r-- | tests/examples/running-commands.py | 39 |
7 files changed, 265 insertions, 125 deletions
diff --git a/tests/examples/autotools.py b/tests/examples/autotools.py index 45783b30c..e684fd43c 100644 --- a/tests/examples/autotools.py +++ b/tests/examples/autotools.py @@ -11,47 +11,71 @@ from buildstream.testing._utils.site import IS_LINUX, MACHINE_ARCH, HAVE_SANDBOX pytestmark = pytest.mark.integration DATA_DIR = os.path.join( - os.path.dirname(os.path.realpath(__file__)), '..', '..', 'doc', 'examples', 'autotools' + os.path.dirname(os.path.realpath(__file__)), + "..", + "..", + "doc", + "examples", + "autotools", ) # Tests a build of the autotools amhello project on a alpine-linux base runtime -@pytest.mark.skipif(MACHINE_ARCH != 'x86-64', - reason='Examples are written for x86-64') -@pytest.mark.skipif(not IS_LINUX or not HAVE_SANDBOX, reason='Only available on linux with sandbox') -@pytest.mark.skipif(HAVE_SANDBOX == 'chroot', reason='This test is not meant to work with chroot sandbox') +@pytest.mark.skipif(MACHINE_ARCH != "x86-64", reason="Examples are written for x86-64") +@pytest.mark.skipif( + not IS_LINUX or not HAVE_SANDBOX, reason="Only available on linux with sandbox" +) +@pytest.mark.skipif( + HAVE_SANDBOX == "chroot", + reason="This test is not meant to work with chroot sandbox", +) @pytest.mark.datafiles(DATA_DIR) def test_autotools_build(cli, datafiles): project = str(datafiles) - checkout = os.path.join(cli.directory, 'checkout') + checkout = os.path.join(cli.directory, "checkout") # Check that the project can be built correctly. - result = cli.run(project=project, args=['build', 'hello.bst']) + result = cli.run(project=project, args=["build", "hello.bst"]) result.assert_success() - result = cli.run(project=project, args=['artifact', 'checkout', 'hello.bst', '--directory', checkout]) + result = cli.run( + project=project, + args=["artifact", "checkout", "hello.bst", "--directory", checkout], + ) result.assert_success() - assert_contains(checkout, ['/usr', '/usr/lib', '/usr/bin', - '/usr/share', - '/usr/bin/hello', - '/usr/share/doc', '/usr/share/doc/amhello', - '/usr/share/doc/amhello/README']) + assert_contains( + checkout, + [ + "/usr", + "/usr/lib", + "/usr/bin", + "/usr/share", + "/usr/bin/hello", + "/usr/share/doc", + "/usr/share/doc/amhello", + "/usr/share/doc/amhello/README", + ], + ) # Test running an executable built with autotools. -@pytest.mark.skipif(MACHINE_ARCH != 'x86-64', - reason='Examples are written for x86-64') -@pytest.mark.skipif(not IS_LINUX or not HAVE_SANDBOX, reason='Only available on linux with sandbox') -@pytest.mark.xfail(HAVE_SANDBOX == 'buildbox', reason='Not working with BuildBox') -@pytest.mark.skipif(HAVE_SANDBOX == 'chroot', reason='This test is not meant to work with chroot sandbox') +@pytest.mark.skipif(MACHINE_ARCH != "x86-64", reason="Examples are written for x86-64") +@pytest.mark.skipif( + not IS_LINUX or not HAVE_SANDBOX, reason="Only available on linux with sandbox" +) +@pytest.mark.xfail(HAVE_SANDBOX == "buildbox", reason="Not working with BuildBox") +@pytest.mark.skipif( + HAVE_SANDBOX == "chroot", + reason="This test is not meant to work with chroot sandbox", +) @pytest.mark.datafiles(DATA_DIR) def test_autotools_run(cli, datafiles): project = str(datafiles) - result = cli.run(project=project, args=['build', 'hello.bst']) + result = cli.run(project=project, args=["build", "hello.bst"]) result.assert_success() - result = cli.run(project=project, args=['shell', 'hello.bst', 'hello']) + result = cli.run(project=project, args=["shell", "hello.bst", "hello"]) result.assert_success() - assert result.output == 'Hello World!\nThis is amhello 1.0.\n' + assert result.output == "Hello World!\nThis is amhello 1.0.\n" diff --git a/tests/examples/developing.py b/tests/examples/developing.py index 53a554b86..df6e82623 100644 --- a/tests/examples/developing.py +++ b/tests/examples/developing.py @@ -12,92 +12,119 @@ import tests.testutils.patch as patch pytestmark = pytest.mark.integration DATA_DIR = os.path.join( - os.path.dirname(os.path.realpath(__file__)), '..', '..', 'doc', 'examples', 'developing' + os.path.dirname(os.path.realpath(__file__)), + "..", + "..", + "doc", + "examples", + "developing", ) # Test that the project builds successfully -@pytest.mark.skipif(MACHINE_ARCH != 'x86-64', - reason='Examples are written for x86-64') -@pytest.mark.skipif(not IS_LINUX or not HAVE_SANDBOX, reason='Only available on linux with SANDBOX') -@pytest.mark.skipif(HAVE_SANDBOX == 'chroot', reason='This is not meant to work with chroot') +@pytest.mark.skipif(MACHINE_ARCH != "x86-64", reason="Examples are written for x86-64") +@pytest.mark.skipif( + not IS_LINUX or not HAVE_SANDBOX, reason="Only available on linux with SANDBOX" +) +@pytest.mark.skipif( + HAVE_SANDBOX == "chroot", reason="This is not meant to work with chroot" +) @pytest.mark.datafiles(DATA_DIR) def test_autotools_build(cli, datafiles): project = str(datafiles) - checkout = os.path.join(cli.directory, 'checkout') + checkout = os.path.join(cli.directory, "checkout") # Check that the project can be built correctly. - result = cli.run(project=project, args=['build', 'hello.bst']) + result = cli.run(project=project, args=["build", "hello.bst"]) result.assert_success() - result = cli.run(project=project, args=['artifact', 'checkout', 'hello.bst', '--directory', checkout]) + result = cli.run( + project=project, + args=["artifact", "checkout", "hello.bst", "--directory", checkout], + ) result.assert_success() - assert_contains(checkout, ['/usr', '/usr/lib', '/usr/bin', - '/usr/share', - '/usr/bin/hello']) + assert_contains( + checkout, ["/usr", "/usr/lib", "/usr/bin", "/usr/share", "/usr/bin/hello"] + ) # Test the unmodified hello command works as expected. -@pytest.mark.skipif(MACHINE_ARCH != 'x86-64', - reason='Examples are written for x86-64') -@pytest.mark.skipif(not IS_LINUX or not HAVE_SANDBOX, reason='Only available on linux with SANDBOX') -@pytest.mark.skipif(HAVE_SANDBOX == 'chroot', reason='This is not meant to work with chroot') +@pytest.mark.skipif(MACHINE_ARCH != "x86-64", reason="Examples are written for x86-64") +@pytest.mark.skipif( + not IS_LINUX or not HAVE_SANDBOX, reason="Only available on linux with SANDBOX" +) +@pytest.mark.skipif( + HAVE_SANDBOX == "chroot", reason="This is not meant to work with chroot" +) @pytest.mark.datafiles(DATA_DIR) def test_run_unmodified_hello(cli, datafiles): project = str(datafiles) - result = cli.run(project=project, args=['build', 'hello.bst']) + result = cli.run(project=project, args=["build", "hello.bst"]) result.assert_success() - result = cli.run(project=project, args=['shell', 'hello.bst', 'hello']) + result = cli.run(project=project, args=["shell", "hello.bst", "hello"]) result.assert_success() - assert result.output == 'Hello World\n' + assert result.output == "Hello World\n" # Test opening a workspace -@pytest.mark.skipif(not IS_LINUX, reason='Only available on linux') +@pytest.mark.skipif(not IS_LINUX, reason="Only available on linux") @pytest.mark.datafiles(DATA_DIR) def test_open_workspace(cli, tmpdir, datafiles): project = str(datafiles) workspace_dir = os.path.join(str(tmpdir), "workspace_hello") - result = cli.run(project=project, args=['workspace', 'open', '-f', '--directory', workspace_dir, 'hello.bst', ]) + result = cli.run( + project=project, + args=["workspace", "open", "-f", "--directory", workspace_dir, "hello.bst",], + ) result.assert_success() - result = cli.run(project=project, args=['workspace', 'list']) + result = cli.run(project=project, args=["workspace", "list"]) result.assert_success() - result = cli.run(project=project, args=['workspace', 'close', '--remove-dir', 'hello.bst']) + result = cli.run( + project=project, args=["workspace", "close", "--remove-dir", "hello.bst"] + ) result.assert_success() # Test making a change using the workspace -@pytest.mark.skipif(MACHINE_ARCH != 'x86-64', - reason='Examples are written for x86-64') -@pytest.mark.skipif(not IS_LINUX or not HAVE_SANDBOX, reason='Only available on linux with SANDBOX') -@pytest.mark.skipif(HAVE_SANDBOX == 'chroot', reason='This is not meant to work with chroot') +@pytest.mark.skipif(MACHINE_ARCH != "x86-64", reason="Examples are written for x86-64") +@pytest.mark.skipif( + not IS_LINUX or not HAVE_SANDBOX, reason="Only available on linux with SANDBOX" +) +@pytest.mark.skipif( + HAVE_SANDBOX == "chroot", reason="This is not meant to work with chroot" +) @pytest.mark.datafiles(DATA_DIR) def test_make_change_in_workspace(cli, tmpdir, datafiles): project = str(datafiles) workspace_dir = os.path.join(str(tmpdir), "workspace_hello") - result = cli.run(project=project, args=['workspace', 'open', '-f', '--directory', workspace_dir, 'hello.bst']) + result = cli.run( + project=project, + args=["workspace", "open", "-f", "--directory", workspace_dir, "hello.bst"], + ) result.assert_success() - result = cli.run(project=project, args=['workspace', 'list']) + result = cli.run(project=project, args=["workspace", "list"]) result.assert_success() patch_target = os.path.join(workspace_dir, "hello.c") patch_source = os.path.join(project, "update.patch") patch.apply(patch_target, patch_source) - result = cli.run(project=project, args=['build', 'hello.bst']) + result = cli.run(project=project, args=["build", "hello.bst"]) result.assert_success() - result = cli.run(project=project, args=['shell', 'hello.bst', '--', 'hello']) + result = cli.run(project=project, args=["shell", "hello.bst", "--", "hello"]) result.assert_success() - assert result.output == 'Hello World\nWe can use workspaces!\n' + assert result.output == "Hello World\nWe can use workspaces!\n" - result = cli.run(project=project, args=['workspace', 'close', '--remove-dir', 'hello.bst']) + result = cli.run( + project=project, args=["workspace", "close", "--remove-dir", "hello.bst"] + ) result.assert_success() diff --git a/tests/examples/first-project.py b/tests/examples/first-project.py index 84ab7aa61..4a378df62 100644 --- a/tests/examples/first-project.py +++ b/tests/examples/first-project.py @@ -13,20 +13,28 @@ pytestmark = pytest.mark.integration DATA_DIR = os.path.join( - os.path.dirname(os.path.realpath(__file__)), '..', '..', 'doc', 'examples', 'first-project' + os.path.dirname(os.path.realpath(__file__)), + "..", + "..", + "doc", + "examples", + "first-project", ) -@pytest.mark.skipif(not IS_LINUX, reason='Only available on linux') +@pytest.mark.skipif(not IS_LINUX, reason="Only available on linux") @pytest.mark.datafiles(DATA_DIR) def test_first_project_build_checkout(cli, datafiles): project = str(datafiles) - checkout = os.path.join(cli.directory, 'checkout') + checkout = os.path.join(cli.directory, "checkout") - result = cli.run(project=project, args=['build', 'hello.bst']) + result = cli.run(project=project, args=["build", "hello.bst"]) assert result.exit_code == 0 - result = cli.run(project=project, args=['artifact', 'checkout', 'hello.bst', '--directory', checkout]) + result = cli.run( + project=project, + args=["artifact", "checkout", "hello.bst", "--directory", checkout], + ) assert result.exit_code == 0 - assert_contains(checkout, ['/hello.world']) + assert_contains(checkout, ["/hello.world"]) diff --git a/tests/examples/flatpak-autotools.py b/tests/examples/flatpak-autotools.py index 2418807c0..4e7a9e36f 100644 --- a/tests/examples/flatpak-autotools.py +++ b/tests/examples/flatpak-autotools.py @@ -13,12 +13,20 @@ pytestmark = pytest.mark.integration DATA_DIR = os.path.join( - os.path.dirname(os.path.realpath(__file__)), '..', '..', 'doc', 'examples', 'flatpak-autotools' + os.path.dirname(os.path.realpath(__file__)), + "..", + "..", + "doc", + "examples", + "flatpak-autotools", ) try: - from bst_plugins_experimental.sources import _ostree # pylint: disable=unused-import + from bst_plugins_experimental.sources import ( + _ostree, + ) # pylint: disable=unused-import + # Even when we have the plugin, it might be missing dependencies. This requires # bst_plugins_experimantal to be fully installed, with host ostree dependencies HAVE_OSTREE_PLUGIN = True @@ -33,9 +41,15 @@ except (ImportError, ValueError): def workaround_setuptools_bug(project): os.makedirs(os.path.join(project, "files", "links"), exist_ok=True) try: - os.symlink(os.path.join("usr", "lib"), os.path.join(project, "files", "links", "lib")) - os.symlink(os.path.join("usr", "bin"), os.path.join(project, "files", "links", "bin")) - os.symlink(os.path.join("usr", "etc"), os.path.join(project, "files", "links", "etc")) + os.symlink( + os.path.join("usr", "lib"), os.path.join(project, "files", "links", "lib") + ) + os.symlink( + os.path.join("usr", "bin"), os.path.join(project, "files", "links", "bin") + ) + os.symlink( + os.path.join("usr", "etc"), os.path.join(project, "files", "links", "etc") + ) except FileExistsError: # If the files exist, we're running from a git checkout and # not a source distribution, no need to complain @@ -44,40 +58,53 @@ def workaround_setuptools_bug(project): # Test that a build upon flatpak runtime 'works' - we use the autotools sample # amhello project for this. -@pytest.mark.skipif(MACHINE_ARCH != 'x86-64', - reason='Examples are written for x86-64') -@pytest.mark.skipif(not IS_LINUX or not HAVE_OSTREE_PLUGIN, reason='Only available on linux with ostree') +@pytest.mark.skipif(MACHINE_ARCH != "x86-64", reason="Examples are written for x86-64") +@pytest.mark.skipif( + not IS_LINUX or not HAVE_OSTREE_PLUGIN, reason="Only available on linux with ostree" +) @pytest.mark.datafiles(DATA_DIR) def test_autotools_build(cli, datafiles): project = str(datafiles) - checkout = os.path.join(cli.directory, 'checkout') + checkout = os.path.join(cli.directory, "checkout") workaround_setuptools_bug(project) - result = cli.run(project=project, args=['build', 'hello.bst']) + result = cli.run(project=project, args=["build", "hello.bst"]) assert result.exit_code == 0 - result = cli.run(project=project, args=['artifact', 'checkout', 'hello.bst', '--directory', checkout]) + result = cli.run( + project=project, + args=["artifact", "checkout", "hello.bst", "--directory", checkout], + ) assert result.exit_code == 0 - assert_contains(checkout, ['/usr', '/usr/lib', '/usr/bin', - '/usr/share', - '/usr/bin/hello', '/usr/share/doc', - '/usr/share/doc/amhello', - '/usr/share/doc/amhello/README']) + assert_contains( + checkout, + [ + "/usr", + "/usr/lib", + "/usr/bin", + "/usr/share", + "/usr/bin/hello", + "/usr/share/doc", + "/usr/share/doc/amhello", + "/usr/share/doc/amhello/README", + ], + ) # Test running an executable built with autotools -@pytest.mark.skipif(MACHINE_ARCH != 'x86-64', - reason='Examples are written for x86-64') -@pytest.mark.skipif(not IS_LINUX or not HAVE_OSTREE_PLUGIN, reason='Only available on linux with ostree') +@pytest.mark.skipif(MACHINE_ARCH != "x86-64", reason="Examples are written for x86-64") +@pytest.mark.skipif( + not IS_LINUX or not HAVE_OSTREE_PLUGIN, reason="Only available on linux with ostree" +) @pytest.mark.datafiles(DATA_DIR) def test_autotools_run(cli, datafiles): project = str(datafiles) workaround_setuptools_bug(project) - result = cli.run(project=project, args=['build', 'hello.bst']) + result = cli.run(project=project, args=["build", "hello.bst"]) assert result.exit_code == 0 - result = cli.run(project=project, args=['shell', 'hello.bst', '/usr/bin/hello']) + result = cli.run(project=project, args=["shell", "hello.bst", "/usr/bin/hello"]) assert result.exit_code == 0 - assert result.output == 'Hello World!\nThis is amhello 1.0.\n' + assert result.output == "Hello World!\nThis is amhello 1.0.\n" diff --git a/tests/examples/integration-commands.py b/tests/examples/integration-commands.py index 1ed888b5d..fac45fd22 100644 --- a/tests/examples/integration-commands.py +++ b/tests/examples/integration-commands.py @@ -10,34 +10,49 @@ from buildstream.testing._utils.site import IS_LINUX, MACHINE_ARCH, HAVE_SANDBOX pytestmark = pytest.mark.integration DATA_DIR = os.path.join( - os.path.dirname(os.path.realpath(__file__)), '..', '..', 'doc', 'examples', 'integration-commands' + os.path.dirname(os.path.realpath(__file__)), + "..", + "..", + "doc", + "examples", + "integration-commands", ) -@pytest.mark.skipif(MACHINE_ARCH != 'x86-64', - reason='Examples are written for x86-64') -@pytest.mark.skipif(not IS_LINUX or not HAVE_SANDBOX, reason='Only available on linux with sandbox') -@pytest.mark.skipif(HAVE_SANDBOX == 'chroot', reason='This test is not meant to work with chroot sandbox') +@pytest.mark.skipif(MACHINE_ARCH != "x86-64", reason="Examples are written for x86-64") +@pytest.mark.skipif( + not IS_LINUX or not HAVE_SANDBOX, reason="Only available on linux with sandbox" +) +@pytest.mark.skipif( + HAVE_SANDBOX == "chroot", + reason="This test is not meant to work with chroot sandbox", +) @pytest.mark.datafiles(DATA_DIR) def test_integration_commands_build(cli, datafiles): project = str(datafiles) - result = cli.run(project=project, args=['build', 'hello.bst']) + result = cli.run(project=project, args=["build", "hello.bst"]) assert result.exit_code == 0 # Test running the executable -@pytest.mark.skipif(MACHINE_ARCH != 'x86-64', - reason='Examples are written for x86-64') -@pytest.mark.skipif(not IS_LINUX or not HAVE_SANDBOX, reason='Only available on linux with sandbox') -@pytest.mark.skipif(HAVE_SANDBOX == 'chroot', reason='This test is not meant to work with chroot sandbox') +@pytest.mark.skipif(MACHINE_ARCH != "x86-64", reason="Examples are written for x86-64") +@pytest.mark.skipif( + not IS_LINUX or not HAVE_SANDBOX, reason="Only available on linux with sandbox" +) +@pytest.mark.skipif( + HAVE_SANDBOX == "chroot", + reason="This test is not meant to work with chroot sandbox", +) @pytest.mark.datafiles(DATA_DIR) def test_integration_commands_run(cli, datafiles): project = str(datafiles) - result = cli.run(project=project, args=['build', 'hello.bst']) + result = cli.run(project=project, args=["build", "hello.bst"]) assert result.exit_code == 0 - result = cli.run(project=project, args=['shell', 'hello.bst', '--', 'hello', 'pony']) + result = cli.run( + project=project, args=["shell", "hello.bst", "--", "hello", "pony"] + ) assert result.exit_code == 0 - assert result.output == 'Hello pony\n' + assert result.output == "Hello pony\n" diff --git a/tests/examples/junctions.py b/tests/examples/junctions.py index 18bf4da4f..e93db8a68 100644 --- a/tests/examples/junctions.py +++ b/tests/examples/junctions.py @@ -10,51 +10,77 @@ from buildstream.testing._utils.site import IS_LINUX, MACHINE_ARCH, HAVE_SANDBOX pytestmark = pytest.mark.integration DATA_DIR = os.path.join( - os.path.dirname(os.path.realpath(__file__)), '..', '..', 'doc', 'examples', 'junctions' + os.path.dirname(os.path.realpath(__file__)), + "..", + "..", + "doc", + "examples", + "junctions", ) # Test that the project builds successfully -@pytest.mark.skipif(MACHINE_ARCH != 'x86-64', - reason='Examples are written for x86-64') -@pytest.mark.skipif(not IS_LINUX or not HAVE_SANDBOX, reason='Only available on linux with bubblewrap') -@pytest.mark.skipif(HAVE_SANDBOX == 'chroot', reason='This test is not meant to work with chroot sandbox') +@pytest.mark.skipif(MACHINE_ARCH != "x86-64", reason="Examples are written for x86-64") +@pytest.mark.skipif( + not IS_LINUX or not HAVE_SANDBOX, reason="Only available on linux with bubblewrap" +) +@pytest.mark.skipif( + HAVE_SANDBOX == "chroot", + reason="This test is not meant to work with chroot sandbox", +) @pytest.mark.datafiles(DATA_DIR) def test_build(cli, datafiles): project = str(datafiles) - result = cli.run(project=project, args=['build', 'callHello.bst']) + result = cli.run(project=project, args=["build", "callHello.bst"]) result.assert_success() # Test the callHello script works as expected. -@pytest.mark.skipif(MACHINE_ARCH != 'x86-64', - reason='Examples are written for x86-64') -@pytest.mark.skipif(not IS_LINUX or not HAVE_SANDBOX, reason='Only available on linux with bubblewrap') -@pytest.mark.skipif(HAVE_SANDBOX == 'chroot', reason='This test is not meant to work with chroot sandbox') +@pytest.mark.skipif(MACHINE_ARCH != "x86-64", reason="Examples are written for x86-64") +@pytest.mark.skipif( + not IS_LINUX or not HAVE_SANDBOX, reason="Only available on linux with bubblewrap" +) +@pytest.mark.skipif( + HAVE_SANDBOX == "chroot", + reason="This test is not meant to work with chroot sandbox", +) @pytest.mark.datafiles(DATA_DIR) def test_shell_call_hello(cli, datafiles): project = str(datafiles) - result = cli.run(project=project, args=['build', 'callHello.bst']) + result = cli.run(project=project, args=["build", "callHello.bst"]) result.assert_success() - result = cli.run(project=project, args=['shell', 'callHello.bst', '--', '/bin/sh', 'callHello.sh']) + result = cli.run( + project=project, + args=["shell", "callHello.bst", "--", "/bin/sh", "callHello.sh"], + ) result.assert_success() - assert result.output == 'Calling hello:\nHello World!\nThis is amhello 1.0.\n' + assert result.output == "Calling hello:\nHello World!\nThis is amhello 1.0.\n" # Test opening a cross-junction workspace -@pytest.mark.skipif(not IS_LINUX, reason='Only available on linux') +@pytest.mark.skipif(not IS_LINUX, reason="Only available on linux") @pytest.mark.datafiles(DATA_DIR) def test_open_cross_junction_workspace(cli, tmpdir, datafiles): project = str(datafiles) workspace_dir = os.path.join(str(tmpdir), "workspace_hello_junction") - result = cli.run(project=project, - args=['workspace', 'open', '--directory', workspace_dir, 'hello-junction.bst:hello.bst']) + result = cli.run( + project=project, + args=[ + "workspace", + "open", + "--directory", + workspace_dir, + "hello-junction.bst:hello.bst", + ], + ) result.assert_success() - result = cli.run(project=project, - args=['workspace', 'close', '--remove-dir', 'hello-junction.bst:hello.bst']) + result = cli.run( + project=project, + args=["workspace", "close", "--remove-dir", "hello-junction.bst:hello.bst"], + ) result.assert_success() diff --git a/tests/examples/running-commands.py b/tests/examples/running-commands.py index 1c419d524..177f4e3cc 100644 --- a/tests/examples/running-commands.py +++ b/tests/examples/running-commands.py @@ -10,34 +10,47 @@ from buildstream.testing._utils.site import IS_LINUX, MACHINE_ARCH, HAVE_SANDBOX pytestmark = pytest.mark.integration DATA_DIR = os.path.join( - os.path.dirname(os.path.realpath(__file__)), '..', '..', 'doc', 'examples', 'running-commands' + os.path.dirname(os.path.realpath(__file__)), + "..", + "..", + "doc", + "examples", + "running-commands", ) -@pytest.mark.skipif(MACHINE_ARCH != 'x86-64', - reason='Examples are written for x86-64') +@pytest.mark.skipif(MACHINE_ARCH != "x86-64", reason="Examples are written for x86-64") @pytest.mark.datafiles(DATA_DIR) -@pytest.mark.skipif(not IS_LINUX or not HAVE_SANDBOX, reason='Only available on linux with sandbox') -@pytest.mark.skipif(HAVE_SANDBOX == 'chroot', reason='This test is not meant to work with chroot sandbox') +@pytest.mark.skipif( + not IS_LINUX or not HAVE_SANDBOX, reason="Only available on linux with sandbox" +) +@pytest.mark.skipif( + HAVE_SANDBOX == "chroot", + reason="This test is not meant to work with chroot sandbox", +) def test_running_commands_build(cli, datafiles): project = str(datafiles) - result = cli.run(project=project, args=['build', 'hello.bst']) + result = cli.run(project=project, args=["build", "hello.bst"]) assert result.exit_code == 0 # Test running the executable -@pytest.mark.skipif(MACHINE_ARCH != 'x86-64', - reason='Examples are written for x86-64') -@pytest.mark.skipif(not IS_LINUX or not HAVE_SANDBOX, reason='Only available on linux with sandbox') -@pytest.mark.skipif(HAVE_SANDBOX == 'chroot', reason='This test is not meant to work with chroot sandbox') +@pytest.mark.skipif(MACHINE_ARCH != "x86-64", reason="Examples are written for x86-64") +@pytest.mark.skipif( + not IS_LINUX or not HAVE_SANDBOX, reason="Only available on linux with sandbox" +) +@pytest.mark.skipif( + HAVE_SANDBOX == "chroot", + reason="This test is not meant to work with chroot sandbox", +) @pytest.mark.datafiles(DATA_DIR) def test_running_commands_run(cli, datafiles): project = str(datafiles) - result = cli.run(project=project, args=['build', 'hello.bst']) + result = cli.run(project=project, args=["build", "hello.bst"]) assert result.exit_code == 0 - result = cli.run(project=project, args=['shell', 'hello.bst', '--', 'hello']) + result = cli.run(project=project, args=["shell", "hello.bst", "--", "hello"]) assert result.exit_code == 0 - assert result.output == 'Hello World\n' + assert result.output == "Hello World\n" |