diff options
author | Angelos Evripiotis <jevripiotis@bloomberg.net> | 2019-03-20 11:06:42 +0000 |
---|---|---|
committer | bst-marge-bot <marge-bot@buildstream.build> | 2019-03-21 14:57:31 +0000 |
commit | f2b15d86debd32241228f7b728016ed0057cd0d2 (patch) | |
tree | e98e085e4f0a9020725aa3a25df7809a96d807ba /tests/integration | |
parent | bc1b971e169f2fc721c61276c071640caee6a3f8 (diff) | |
download | buildstream-f2b15d86debd32241228f7b728016ed0057cd0d2.tar.gz |
tests: str(datafiles) instead of a longer thing
Replace some popular copypasta.
This important-looking invocation:
os.path.join(datafiles.dirname, datafiles.basename)
is equivalent to this shorter invocation:
project = str(datafiles)
It seems like it's very popular copypasta, replace it with the shorter
one thus:
# Use 'gsed' or 'sed' etc. as appropriate for your system.
git config --global alias.sub '!f() { git grep --name-only --null "$1" | gxargs --null gsed --in-place --expression "s/$1/$2/g" ; }; f'
git sub 'os.path.join(datafiles.dirname, datafiles.basename)' 'str(datafiles)'
Diffstat (limited to 'tests/integration')
-rw-r--r-- | tests/integration/artifact.py | 2 | ||||
-rw-r--r-- | tests/integration/autotools.py | 6 | ||||
-rw-r--r-- | tests/integration/build-uid.py | 6 | ||||
-rw-r--r-- | tests/integration/cachedfail.py | 8 | ||||
-rw-r--r-- | tests/integration/cmake.py | 6 | ||||
-rw-r--r-- | tests/integration/compose-symlinks.py | 2 | ||||
-rw-r--r-- | tests/integration/compose.py | 2 | ||||
-rw-r--r-- | tests/integration/import.py | 2 | ||||
-rw-r--r-- | tests/integration/make.py | 4 | ||||
-rw-r--r-- | tests/integration/manual.py | 8 | ||||
-rw-r--r-- | tests/integration/messages.py | 4 | ||||
-rw-r--r-- | tests/integration/pip_element.py | 4 | ||||
-rw-r--r-- | tests/integration/pip_source.py | 4 | ||||
-rw-r--r-- | tests/integration/pullbuildtrees.py | 4 | ||||
-rw-r--r-- | tests/integration/sandbox-bwrap.py | 6 | ||||
-rw-r--r-- | tests/integration/script.py | 10 | ||||
-rw-r--r-- | tests/integration/shell.py | 30 | ||||
-rw-r--r-- | tests/integration/shellbuildtrees.py | 20 | ||||
-rw-r--r-- | tests/integration/sockets.py | 4 | ||||
-rw-r--r-- | tests/integration/stack.py | 2 | ||||
-rw-r--r-- | tests/integration/symlinks.py | 6 | ||||
-rw-r--r-- | tests/integration/workspace.py | 12 |
22 files changed, 76 insertions, 76 deletions
diff --git a/tests/integration/artifact.py b/tests/integration/artifact.py index 1f6028e4b..f9470ed6b 100644 --- a/tests/integration/artifact.py +++ b/tests/integration/artifact.py @@ -46,7 +46,7 @@ DATA_DIR = os.path.join( @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') def test_cache_buildtrees(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) element_name = 'autotools/amhello.bst' # Create artifact shares for pull & push testing diff --git a/tests/integration/autotools.py b/tests/integration/autotools.py index 71cb4590f..d9dcc10ed 100644 --- a/tests/integration/autotools.py +++ b/tests/integration/autotools.py @@ -20,7 +20,7 @@ DATA_DIR = os.path.join( @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') def test_autotools_build(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) checkout = os.path.join(cli.directory, 'checkout') element_name = 'autotools/amhello.bst' @@ -42,7 +42,7 @@ def test_autotools_build(cli, datafiles): @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') def test_autotools_confroot_build(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) checkout = os.path.join(cli.directory, 'checkout') element_name = 'autotools/amhelloconfroot.bst' @@ -63,7 +63,7 @@ def test_autotools_confroot_build(cli, datafiles): @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') def test_autotools_run(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) element_name = 'autotools/amhello.bst' result = cli.run(project=project, args=['build', element_name]) diff --git a/tests/integration/build-uid.py b/tests/integration/build-uid.py index c5e213085..bb2e013c2 100644 --- a/tests/integration/build-uid.py +++ b/tests/integration/build-uid.py @@ -16,7 +16,7 @@ DATA_DIR = os.path.join( @pytest.mark.skipif(not IS_LINUX or not HAVE_BWRAP, reason='Only available on linux with bubblewrap') @pytest.mark.datafiles(DATA_DIR) def test_build_uid_overridden(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) element_name = 'build-uid/build-uid.bst' project_config = { @@ -34,7 +34,7 @@ def test_build_uid_overridden(cli, datafiles): @pytest.mark.skipif(not IS_LINUX or not HAVE_BWRAP, reason='Only available on linux with bubbelwrap') @pytest.mark.datafiles(DATA_DIR) def test_build_uid_in_project(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) element_name = 'build-uid/build-uid-1023.bst' project_config = { @@ -52,7 +52,7 @@ def test_build_uid_in_project(cli, datafiles): @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') def test_build_uid_default(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) element_name = 'build-uid/build-uid-default.bst' result = cli.run(project=project, args=['build', element_name]) diff --git a/tests/integration/cachedfail.py b/tests/integration/cachedfail.py index 171a21afc..34849f8bc 100644 --- a/tests/integration/cachedfail.py +++ b/tests/integration/cachedfail.py @@ -22,7 +22,7 @@ DATA_DIR = os.path.join( @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') def test_build_checkout_cached_fail(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) element_path = os.path.join(project, 'elements', 'element.bst') checkout = os.path.join(cli.directory, 'checkout') @@ -65,7 +65,7 @@ def test_build_checkout_cached_fail(cli, datafiles): @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') def test_build_depend_on_cached_fail(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) dep_path = os.path.join(project, 'elements', 'dep.bst') target_path = os.path.join(project, 'elements', 'target.bst') @@ -127,7 +127,7 @@ def test_push_cached_fail(cli, tmpdir, datafiles, on_error): if on_error == 'quit': pytest.xfail('https://gitlab.com/BuildStream/buildstream/issues/534') - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) element_path = os.path.join(project, 'elements', 'element.bst') # Write out our test target @@ -167,7 +167,7 @@ def test_push_cached_fail(cli, tmpdir, datafiles, on_error): @pytest.mark.skipif(not (IS_LINUX and HAVE_BWRAP), reason='Only available with bubblewrap on Linux') @pytest.mark.datafiles(DATA_DIR) def test_host_tools_errors_are_not_cached(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) element_path = os.path.join(project, 'elements', 'element.bst') # Write out our test target diff --git a/tests/integration/cmake.py b/tests/integration/cmake.py index 408f0deff..ddd8ce95d 100644 --- a/tests/integration/cmake.py +++ b/tests/integration/cmake.py @@ -18,7 +18,7 @@ DATA_DIR = os.path.join( @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') def test_cmake_build(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) checkout = os.path.join(cli.directory, 'checkout') element_name = 'cmake/cmakehello.bst' @@ -34,7 +34,7 @@ def test_cmake_build(cli, datafiles): @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') def test_cmake_confroot_build(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) checkout = os.path.join(cli.directory, 'checkout') element_name = 'cmake/cmakeconfroothello.bst' @@ -50,7 +50,7 @@ def test_cmake_confroot_build(cli, datafiles): @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') def test_cmake_run(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) element_name = 'cmake/cmakehello.bst' result = cli.run(project=project, args=['build', element_name]) diff --git a/tests/integration/compose-symlinks.py b/tests/integration/compose-symlinks.py index ee7689e6e..6f9e0ea7d 100644 --- a/tests/integration/compose-symlinks.py +++ b/tests/integration/compose-symlinks.py @@ -19,7 +19,7 @@ DATA_DIR = os.path.join( # noinspection PyUnusedLocal @pytest.mark.datafiles(DATA_DIR) def test_compose_symlinks(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) # Symlinks do not survive being placed in a source distribution # ('setup.py sdist'), so we have to create the one we need here. diff --git a/tests/integration/compose.py b/tests/integration/compose.py index d15821d79..e0de38655 100644 --- a/tests/integration/compose.py +++ b/tests/integration/compose.py @@ -76,7 +76,7 @@ def create_compose_element(name, path, config={}): @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') def test_compose_include(cli, datafiles, include_domains, exclude_domains, expected): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) checkout = os.path.join(cli.directory, 'checkout') element_path = os.path.join(project, 'elements') element_name = 'compose/compose-amhello.bst' diff --git a/tests/integration/import.py b/tests/integration/import.py index 85cbf9cd1..501f8aa9e 100644 --- a/tests/integration/import.py +++ b/tests/integration/import.py @@ -43,7 +43,7 @@ def create_import_element(name, path, source, target, source_path): '/output/subdir/test.txt']), ]) def test_import(cli, datafiles, source, target, path, expected): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) checkout = os.path.join(cli.directory, 'checkout') element_path = os.path.join(project, 'elements') element_name = 'import/import.bst' diff --git a/tests/integration/make.py b/tests/integration/make.py index 01c19ce20..581d919e7 100644 --- a/tests/integration/make.py +++ b/tests/integration/make.py @@ -20,7 +20,7 @@ DATA_DIR = os.path.join( @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') def test_make_build(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) checkout = os.path.join(cli.directory, 'checkout') element_name = 'make/makehello.bst' @@ -38,7 +38,7 @@ def test_make_build(cli, datafiles): @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') def test_make_run(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) element_name = 'make/makehello.bst' result = cli.run(project=project, args=['build', element_name]) diff --git a/tests/integration/manual.py b/tests/integration/manual.py index 507434eaa..76ea1dc66 100644 --- a/tests/integration/manual.py +++ b/tests/integration/manual.py @@ -34,7 +34,7 @@ def create_manual_element(name, path, config, variables, environment): @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') def test_manual_element(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) checkout = os.path.join(cli.directory, 'checkout') element_path = os.path.join(project, 'elements') element_name = 'import/import.bst' @@ -68,7 +68,7 @@ strip @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') def test_manual_element_environment(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) checkout = os.path.join(cli.directory, 'checkout') element_path = os.path.join(project, 'elements') element_name = 'import/import.bst' @@ -98,7 +98,7 @@ def test_manual_element_environment(cli, datafiles): @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') def test_manual_element_noparallel(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) checkout = os.path.join(cli.directory, 'checkout') element_path = os.path.join(project, 'elements') element_name = 'import/import.bst' @@ -133,7 +133,7 @@ def test_manual_element_noparallel(cli, datafiles): @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') def test_manual_element_logging(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) element_path = os.path.join(project, 'elements') element_name = 'import/import.bst' diff --git a/tests/integration/messages.py b/tests/integration/messages.py index b633eefdf..3697d0bf7 100644 --- a/tests/integration/messages.py +++ b/tests/integration/messages.py @@ -39,7 +39,7 @@ DATA_DIR = os.path.join( @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') def test_disable_message_lines(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) element_path = os.path.join(project, 'elements') element_name = 'message.bst' @@ -74,7 +74,7 @@ def test_disable_message_lines(cli, datafiles): @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') def test_disable_error_lines(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) element_path = os.path.join(project, 'elements') element_name = 'message.bst' diff --git a/tests/integration/pip_element.py b/tests/integration/pip_element.py index d49e80d8d..a3f363bc8 100644 --- a/tests/integration/pip_element.py +++ b/tests/integration/pip_element.py @@ -21,7 +21,7 @@ DATA_DIR = os.path.join( @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') def test_pip_build(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) checkout = os.path.join(cli.directory, 'checkout') element_path = os.path.join(project, 'elements') element_name = 'pip/hello.bst' @@ -61,7 +61,7 @@ def test_pip_run(cli, datafiles): # Create and build our test element test_pip_build(cli, datafiles) - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) element_name = 'pip/hello.bst' result = cli.run(project=project, args=['shell', element_name, '/usr/bin/hello']) diff --git a/tests/integration/pip_source.py b/tests/integration/pip_source.py index 7cda6d29b..6ee76005c 100644 --- a/tests/integration/pip_source.py +++ b/tests/integration/pip_source.py @@ -20,7 +20,7 @@ DATA_DIR = os.path.join( @pytest.mark.datafiles(DATA_DIR) def test_pip_source_import(cli, datafiles, setup_pypi_repo): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) checkout = os.path.join(cli.directory, 'checkout') element_path = os.path.join(project, 'elements') element_name = 'pip/hello.bst' @@ -75,7 +75,7 @@ def test_pip_source_import(cli, datafiles, setup_pypi_repo): @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') def test_pip_source_build(cli, datafiles, setup_pypi_repo): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) element_path = os.path.join(project, 'elements') element_name = 'pip/hello.bst' diff --git a/tests/integration/pullbuildtrees.py b/tests/integration/pullbuildtrees.py index 6a3b92723..4ed5cb86b 100644 --- a/tests/integration/pullbuildtrees.py +++ b/tests/integration/pullbuildtrees.py @@ -38,7 +38,7 @@ def default_state(cli, tmpdir, share): @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') def test_pullbuildtrees(cli2, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) element_name = 'autotools/amhello.bst' # Create artifact shares for pull & push testing @@ -178,7 +178,7 @@ def test_pullbuildtrees(cli2, tmpdir, datafiles): ]) @pytest.mark.datafiles(DATA_DIR) def test_invalid_cache_pullbuildtrees(cli, datafiles, value, success): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) cli.configure({ 'cache': { diff --git a/tests/integration/sandbox-bwrap.py b/tests/integration/sandbox-bwrap.py index b898f5fed..29227501c 100644 --- a/tests/integration/sandbox-bwrap.py +++ b/tests/integration/sandbox-bwrap.py @@ -22,7 +22,7 @@ DATA_DIR = os.path.join( @pytest.mark.skipif(not HAVE_BWRAP, reason='Only available with bubblewrap') @pytest.mark.datafiles(DATA_DIR) def test_sandbox_bwrap_cleanup_build(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) # This element depends on a base image with non-empty `/tmp` folder. element_name = 'sandbox-bwrap/test-cleanup.bst' @@ -35,7 +35,7 @@ def test_sandbox_bwrap_cleanup_build(cli, datafiles): @pytest.mark.skipif(not HAVE_BWRAP_JSON_STATUS, reason='Only available with bubblewrap supporting --json-status-fd') @pytest.mark.datafiles(DATA_DIR) def test_sandbox_bwrap_distinguish_setup_error(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) element_name = 'sandbox-bwrap/non-executable-shell.bst' result = cli.run(project=project, args=['build', element_name]) @@ -45,7 +45,7 @@ def test_sandbox_bwrap_distinguish_setup_error(cli, datafiles): @pytest.mark.skipif(not HAVE_BWRAP, reason='Only available with bubblewrap') @pytest.mark.datafiles(DATA_DIR) def test_sandbox_bwrap_return_subprocess(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) element_name = 'sandbox-bwrap/command-exit-42.bst' cli.configure({ diff --git a/tests/integration/script.py b/tests/integration/script.py index db7da0ad5..1500af724 100644 --- a/tests/integration/script.py +++ b/tests/integration/script.py @@ -32,7 +32,7 @@ def create_script_element(name, path, config={}, variables={}): @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') def test_script(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) checkout = os.path.join(cli.directory, 'checkout') element_path = os.path.join(project, 'elements') element_name = 'script/script-layout.bst' @@ -60,7 +60,7 @@ def test_script(cli, datafiles): @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') def test_script_root(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) checkout = os.path.join(cli.directory, 'checkout') element_path = os.path.join(project, 'elements') element_name = 'script/script-layout.bst' @@ -92,7 +92,7 @@ def test_script_root(cli, datafiles): @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') def test_script_no_root(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) element_path = os.path.join(project, 'elements') element_name = 'script/script-layout.bst' @@ -115,7 +115,7 @@ def test_script_no_root(cli, datafiles): @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') def test_script_cwd(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) checkout = os.path.join(cli.directory, 'checkout') element_path = os.path.join(project, 'elements') element_name = 'script/script-layout.bst' @@ -146,7 +146,7 @@ def test_script_cwd(cli, datafiles): @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') def test_script_layout(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) checkout = os.path.join(cli.directory, 'checkout') element_name = 'script/script-layout.bst' diff --git a/tests/integration/shell.py b/tests/integration/shell.py index 3246d108a..fb01f45ea 100644 --- a/tests/integration/shell.py +++ b/tests/integration/shell.py @@ -49,7 +49,7 @@ def execute_shell(cli, project, command, *, config=None, mount=None, element='ba @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') def test_shell(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) result = execute_shell(cli, project, ["echo", "Ponies!"]) assert result.exit_code == 0 @@ -60,7 +60,7 @@ def test_shell(cli, datafiles): @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') def test_executable(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) result = execute_shell(cli, project, ["/bin/echo", "Horseys!"]) assert result.exit_code == 0 @@ -72,7 +72,7 @@ def test_executable(cli, datafiles): @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') def test_env_assign(cli, datafiles, animal): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) expected = animal + '\n' result = execute_shell(cli, project, ['/bin/sh', '-c', 'echo ${ANIMAL}'], config={ @@ -92,7 +92,7 @@ def test_env_assign(cli, datafiles, animal): @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') def test_env_assign_expand_host_environ(cli, datafiles, animal): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) expected = 'The animal is: {}\n'.format(animal) os.environ['BEAST'] = animal @@ -115,7 +115,7 @@ def test_env_assign_expand_host_environ(cli, datafiles, animal): @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') def test_env_assign_isolated(cli, datafiles, animal): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) result = execute_shell(cli, project, ['/bin/sh', '-c', 'echo ${ANIMAL}'], isolate=True, config={ 'shell': { 'environment': { @@ -133,7 +133,7 @@ def test_env_assign_isolated(cli, datafiles, animal): @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') def test_no_shell(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) element_path = os.path.join(project, 'elements') element_name = 'shell/no-shell.bst' @@ -166,7 +166,7 @@ def test_no_shell(cli, datafiles): @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') def test_host_files(cli, datafiles, path): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) ponyfile = os.path.join(project, 'files', 'shell-mount', 'pony.txt') result = execute_shell(cli, project, ['cat', path], config={ 'shell': { @@ -187,7 +187,7 @@ def test_host_files(cli, datafiles, path): @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') def test_host_files_expand_environ(cli, datafiles, path): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) hostpath = os.path.join(project, 'files', 'shell-mount') fullpath = os.path.join(path, 'pony.txt') @@ -213,7 +213,7 @@ def test_host_files_expand_environ(cli, datafiles, path): @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') def test_isolated_no_mount(cli, datafiles, path): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) ponyfile = os.path.join(project, 'files', 'shell-mount', 'pony.txt') result = execute_shell(cli, project, ['cat', path], isolate=True, config={ 'shell': { @@ -236,7 +236,7 @@ def test_isolated_no_mount(cli, datafiles, path): @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') def test_host_files_missing(cli, datafiles, optional): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) ponyfile = os.path.join(project, 'files', 'shell-mount', 'horsy.txt') if optional == "optional": @@ -272,7 +272,7 @@ def test_host_files_missing(cli, datafiles, optional): @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') def test_cli_mount(cli, datafiles, path): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) ponyfile = os.path.join(project, 'files', 'shell-mount', 'pony.txt') result = execute_shell(cli, project, ['cat', path], mount=(ponyfile, path)) @@ -284,7 +284,7 @@ def test_cli_mount(cli, datafiles, path): @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') def test_workspace_visible(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) workspace = os.path.join(cli.directory, 'workspace') element_name = 'workspace/workspace-mount-fail.bst' @@ -318,7 +318,7 @@ def test_workspace_visible(cli, datafiles): @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') def test_sysroot(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) base_element = "base/base-alpine.bst" # test element only needs to be something lightweight for this test test_element = "script/script.bst" @@ -348,7 +348,7 @@ def test_sysroot(cli, tmpdir, datafiles): @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') def test_integration_devices(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) element_name = 'integration.bst' result = execute_shell(cli, project, ["true"], element=element_name) @@ -362,7 +362,7 @@ def test_integration_devices(cli, datafiles): @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') def test_integration_external_workspace(cli, tmpdir_factory, datafiles, build_shell, guess_element): tmpdir = tmpdir_factory.mktemp("") - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) element_name = 'autotools/amhello.bst' workspace_dir = os.path.join(str(tmpdir), 'workspace') diff --git a/tests/integration/shellbuildtrees.py b/tests/integration/shellbuildtrees.py index fed3c5167..c12a0d404 100644 --- a/tests/integration/shellbuildtrees.py +++ b/tests/integration/shellbuildtrees.py @@ -23,7 +23,7 @@ def test_buildtree_staged(cli_integration, datafiles): # We can only test the non interacitve case # The non interactive case defaults to not using buildtrees # for `bst shell --build` - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) element_name = 'build-shell/buildtree.bst' res = cli_integration.run(project=project, args=['--cache-buildtrees', 'always', 'build', element_name]) @@ -39,7 +39,7 @@ def test_buildtree_staged(cli_integration, datafiles): @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') def test_buildtree_staged_forced_true(cli_integration, datafiles): # Test that if we ask for a build tree it is there. - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) element_name = 'build-shell/buildtree.bst' res = cli_integration.run(project=project, args=['--cache-buildtrees', 'always', 'build', element_name]) @@ -56,7 +56,7 @@ def test_buildtree_staged_forced_true(cli_integration, datafiles): @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') def test_buildtree_staged_warn_empty_cached(cli_integration, tmpdir, datafiles): # Test that if we stage a cached and empty buildtree, we warn the user. - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) element_name = 'build-shell/buildtree.bst' # Switch to a temp artifact cache dir to ensure the artifact is rebuilt, @@ -79,7 +79,7 @@ def test_buildtree_staged_warn_empty_cached(cli_integration, tmpdir, datafiles): @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') def test_buildtree_staged_if_available(cli_integration, datafiles): # Test that a build tree can be correctly detected. - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) element_name = 'build-shell/buildtree.bst' res = cli_integration.run(project=project, args=['--cache-buildtrees', 'always', 'build', element_name]) @@ -96,7 +96,7 @@ def test_buildtree_staged_if_available(cli_integration, datafiles): @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') def test_buildtree_staged_forced_false(cli_integration, datafiles): # Test that if we ask not to have a build tree it is not there - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) element_name = 'build-shell/buildtree.bst' res = cli_integration.run(project=project, args=['--cache-buildtrees', 'always', 'build', element_name]) @@ -114,7 +114,7 @@ def test_buildtree_staged_forced_false(cli_integration, datafiles): @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') def test_buildtree_from_failure(cli_integration, datafiles): # Test that we can use a build tree after a failure - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) element_name = 'build-shell/buildtree-fail.bst' res = cli_integration.run(project=project, args=['build', element_name]) @@ -133,7 +133,7 @@ def test_buildtree_from_failure(cli_integration, datafiles): @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') def test_buildtree_from_failure_option_never(cli_integration, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) element_name = 'build-shell/buildtree-fail.bst' # Switch to a temp artifact cache dir to ensure the artifact is rebuilt, @@ -156,7 +156,7 @@ def test_buildtree_from_failure_option_never(cli_integration, tmpdir, datafiles) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') def test_buildtree_from_failure_option_always(cli_integration, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) element_name = 'build-shell/buildtree-fail.bst' # build with --cache-buildtrees set to 'always', behaviour should match @@ -182,7 +182,7 @@ def test_buildtree_from_failure_option_always(cli_integration, tmpdir, datafiles @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') def test_buildtree_pulled(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) element_name = 'build-shell/buildtree.bst' with create_artifact_share(os.path.join(str(tmpdir), 'artifactshare')) as share: @@ -214,7 +214,7 @@ def test_buildtree_pulled(cli, tmpdir, datafiles): @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') def test_buildtree_options(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) element_name = 'build-shell/buildtree.bst' with create_artifact_share(os.path.join(str(tmpdir), 'artifactshare')) as share: diff --git a/tests/integration/sockets.py b/tests/integration/sockets.py index 6dc6b682c..17c3becea 100644 --- a/tests/integration/sockets.py +++ b/tests/integration/sockets.py @@ -16,7 +16,7 @@ DATA_DIR = os.path.join( @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') def test_builddir_socket_ignored(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) element_name = 'sockets/make-builddir-socket.bst' result = cli.run(project=project, args=['build', element_name]) @@ -26,7 +26,7 @@ def test_builddir_socket_ignored(cli, datafiles): @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') def test_install_root_socket_ignored(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) element_name = 'sockets/make-install-root-socket.bst' result = cli.run(project=project, args=['build', element_name]) diff --git a/tests/integration/stack.py b/tests/integration/stack.py index f8c837bbb..e75c6a450 100644 --- a/tests/integration/stack.py +++ b/tests/integration/stack.py @@ -17,7 +17,7 @@ DATA_DIR = os.path.join( @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') def test_stack(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) checkout = os.path.join(cli.directory, 'checkout') element_name = 'stack/stack.bst' diff --git a/tests/integration/symlinks.py b/tests/integration/symlinks.py index 1c2f3c2a7..5752281de 100644 --- a/tests/integration/symlinks.py +++ b/tests/integration/symlinks.py @@ -17,7 +17,7 @@ DATA_DIR = os.path.join( @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') def test_absolute_symlinks(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) checkout = os.path.join(cli.directory, 'checkout') element_name = 'symlinks/dangling-symlink.bst' @@ -38,7 +38,7 @@ def test_absolute_symlinks(cli, datafiles): @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') def test_disallow_overlaps_inside_symlink_with_dangling_target(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) checkout = os.path.join(cli.directory, 'checkout') element_name = 'symlinks/dangling-symlink-overlap.bst' @@ -53,7 +53,7 @@ def test_disallow_overlaps_inside_symlink_with_dangling_target(cli, datafiles): @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') def test_detect_symlink_overlaps_pointing_outside_sandbox(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) checkout = os.path.join(cli.directory, 'checkout') element_name = 'symlinks/symlink-to-outside-sandbox-overlap.bst' diff --git a/tests/integration/workspace.py b/tests/integration/workspace.py index fd2aff3ac..8ec6db3c8 100644 --- a/tests/integration/workspace.py +++ b/tests/integration/workspace.py @@ -18,7 +18,7 @@ DATA_DIR = os.path.join( @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') def test_workspace_mount(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) workspace = os.path.join(cli.directory, 'workspace') element_name = 'workspace/workspace-mount.bst' @@ -34,7 +34,7 @@ def test_workspace_mount(cli, datafiles): @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') def test_workspace_commanddir(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) workspace = os.path.join(cli.directory, 'workspace') element_name = 'workspace/workspace-commanddir.bst' @@ -51,7 +51,7 @@ def test_workspace_commanddir(cli, datafiles): @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') def test_workspace_updated_dependency(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) workspace = os.path.join(cli.directory, 'workspace') element_path = os.path.join(project, 'elements') element_name = 'workspace/workspace-updated-dependency.bst' @@ -105,7 +105,7 @@ def test_workspace_updated_dependency(cli, datafiles): @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') def test_workspace_update_dependency_failed(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) workspace = os.path.join(cli.directory, 'workspace') element_path = os.path.join(project, 'elements') element_name = 'workspace/workspace-updated-dependency-failed.bst' @@ -180,7 +180,7 @@ def test_workspace_update_dependency_failed(cli, datafiles): @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') def test_updated_dependency_nested(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) workspace = os.path.join(cli.directory, 'workspace') element_path = os.path.join(project, 'elements') element_name = 'workspace/workspace-updated-dependency-nested.bst' @@ -233,7 +233,7 @@ def test_updated_dependency_nested(cli, datafiles): @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') def test_incremental_configure_commands_run_only_once(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) workspace = os.path.join(cli.directory, 'workspace') element_path = os.path.join(project, 'elements') element_name = 'workspace/incremental.bst' |