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 | |
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')
72 files changed, 327 insertions, 327 deletions
diff --git a/tests/artifactcache/expiry.py b/tests/artifactcache/expiry.py index e39357534..38c0e21f0 100644 --- a/tests/artifactcache/expiry.py +++ b/tests/artifactcache/expiry.py @@ -39,7 +39,7 @@ DATA_DIR = os.path.join( # not have enough space left. @pytest.mark.datafiles(DATA_DIR) def test_artifact_expires(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) element_path = 'elements' cli.configure({ @@ -81,7 +81,7 @@ def test_artifact_expires(cli, datafiles): ]) @pytest.mark.datafiles(DATA_DIR) def test_artifact_too_large(cli, datafiles, size): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) element_path = 'elements' cli.configure({ @@ -99,7 +99,7 @@ def test_artifact_too_large(cli, datafiles, size): @pytest.mark.datafiles(DATA_DIR) def test_expiry_order(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) element_path = 'elements' checkout = os.path.join(project, 'workspace') @@ -156,7 +156,7 @@ def test_expiry_order(cli, datafiles): # wouldn't it? @pytest.mark.datafiles(DATA_DIR) def test_keep_dependencies(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) element_path = 'elements' cli.configure({ @@ -202,7 +202,7 @@ def test_keep_dependencies(cli, datafiles): # Assert that we never delete a dependency required for a build tree @pytest.mark.datafiles(DATA_DIR) def test_never_delete_required(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) element_path = 'elements' cli.configure({ @@ -254,7 +254,7 @@ def test_never_delete_required(cli, datafiles): # @pytest.mark.datafiles(DATA_DIR) def test_never_delete_required_track(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) element_path = 'elements' cli.configure({ @@ -346,7 +346,7 @@ def test_never_delete_required_track(cli, datafiles): ]) @pytest.mark.datafiles(DATA_DIR) def test_invalid_cache_quota(cli, datafiles, quota, err_domain, err_reason): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) os.makedirs(os.path.join(project, 'elements')) cli.configure({ @@ -397,7 +397,7 @@ def test_invalid_cache_quota(cli, datafiles, quota, err_domain, err_reason): # @pytest.mark.datafiles(DATA_DIR) def test_cleanup_first(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) element_path = 'elements' cli.configure({ diff --git a/tests/cachekey/cachekey.py b/tests/cachekey/cachekey.py index 2bc60582a..bfeb89a8b 100644 --- a/tests/cachekey/cachekey.py +++ b/tests/cachekey/cachekey.py @@ -158,7 +158,7 @@ DATA_DIR = os.path.join( @pytest.mark.skipif(HAVE_OSTREE is False, reason="ostree is not available") @pytest.mark.datafiles(DATA_DIR) def test_cache_key(datafiles, cli): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) # Workaround bug in recent versions of setuptools: newer # versions of setuptools fail to preserve symbolic links @@ -228,7 +228,7 @@ def test_keys_stable_over_targets(cli, datafiles): target1 = 'elements/key-stability/t1.bst' target2 = 'elements/key-stability/t2.bst' - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) full_graph_result = cli.run(project=project, args=[ 'show', '--format', '%{name}::%{full-key}', diff --git a/tests/elements/filter.py b/tests/elements/filter.py index 94a704c92..56e4c2b5a 100644 --- a/tests/elements/filter.py +++ b/tests/elements/filter.py @@ -19,7 +19,7 @@ DATA_DIR = os.path.join( @pytest.mark.datafiles(os.path.join(DATA_DIR, 'basic')) def test_filter_include(datafiles, cli, tmpdir): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) result = cli.run(project=project, args=['build', 'output-include.bst']) result.assert_success() @@ -32,7 +32,7 @@ def test_filter_include(datafiles, cli, tmpdir): @pytest.mark.datafiles(os.path.join(DATA_DIR, 'basic')) def test_filter_include_dynamic(datafiles, cli, tmpdir): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) result = cli.run(project=project, args=['build', 'output-dynamic-include.bst']) result.assert_success() @@ -46,7 +46,7 @@ def test_filter_include_dynamic(datafiles, cli, tmpdir): @pytest.mark.datafiles(os.path.join(DATA_DIR, 'basic')) def test_filter_exclude(datafiles, cli, tmpdir): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) result = cli.run(project=project, args=['build', 'output-exclude.bst']) result.assert_success() @@ -59,7 +59,7 @@ def test_filter_exclude(datafiles, cli, tmpdir): @pytest.mark.datafiles(os.path.join(DATA_DIR, 'basic')) def test_filter_orphans(datafiles, cli, tmpdir): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) result = cli.run(project=project, args=['build', 'output-orphans.bst']) result.assert_success() @@ -71,7 +71,7 @@ def test_filter_orphans(datafiles, cli, tmpdir): @pytest.mark.datafiles(os.path.join(DATA_DIR, 'basic')) def test_filter_deps_ok(datafiles, cli): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) result = cli.run(project=project, args=['build', 'deps-permitted.bst']) result.assert_success() @@ -85,35 +85,35 @@ def test_filter_deps_ok(datafiles, cli): @pytest.mark.datafiles(os.path.join(DATA_DIR, 'basic')) def test_filter_forbid_sources(datafiles, cli): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) result = cli.run(project=project, args=['build', 'forbidden-source.bst']) result.assert_main_error(ErrorDomain.ELEMENT, 'element-forbidden-sources') @pytest.mark.datafiles(os.path.join(DATA_DIR, 'basic')) def test_filter_forbid_multi_bdep(datafiles, cli): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) result = cli.run(project=project, args=['build', 'forbidden-multi-bdep.bst']) result.assert_main_error(ErrorDomain.ELEMENT, 'filter-bdepend-wrong-count') @pytest.mark.datafiles(os.path.join(DATA_DIR, 'basic')) def test_filter_forbid_no_bdep(datafiles, cli): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) result = cli.run(project=project, args=['build', 'forbidden-no-bdep.bst']) result.assert_main_error(ErrorDomain.ELEMENT, 'filter-bdepend-wrong-count') @pytest.mark.datafiles(os.path.join(DATA_DIR, 'basic')) def test_filter_forbid_also_rdep(datafiles, cli): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) result = cli.run(project=project, args=['build', 'forbidden-also-rdep.bst']) result.assert_main_error(ErrorDomain.ELEMENT, 'filter-bdepend-also-rdepend') @pytest.mark.datafiles(os.path.join(DATA_DIR, 'basic')) def test_filter_workspace_open(datafiles, cli, tmpdir): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) workspace_dir = os.path.join(tmpdir.dirname, tmpdir.basename, "workspace") result = cli.run(project=project, args=['workspace', 'open', '--directory', workspace_dir, 'deps-permitted.bst']) result.assert_success() @@ -124,7 +124,7 @@ def test_filter_workspace_open(datafiles, cli, tmpdir): @pytest.mark.datafiles(os.path.join(DATA_DIR, 'basic')) def test_filter_workspace_open_multi(datafiles, cli): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) result = cli.run(cwd=project, project=project, args=['workspace', 'open', 'deps-permitted.bst', 'output-orphans.bst']) result.assert_success() @@ -133,7 +133,7 @@ def test_filter_workspace_open_multi(datafiles, cli): @pytest.mark.datafiles(os.path.join(DATA_DIR, 'basic')) def test_filter_workspace_build(datafiles, cli, tmpdir): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) tempdir = os.path.join(tmpdir.dirname, tmpdir.basename) workspace_dir = os.path.join(tempdir, "workspace") result = cli.run(project=project, args=['workspace', 'open', '--directory', workspace_dir, 'output-orphans.bst']) @@ -151,7 +151,7 @@ def test_filter_workspace_build(datafiles, cli, tmpdir): @pytest.mark.datafiles(os.path.join(DATA_DIR, 'basic')) def test_filter_workspace_close(datafiles, cli, tmpdir): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) tempdir = os.path.join(tmpdir.dirname, tmpdir.basename) workspace_dir = os.path.join(tempdir, "workspace") result = cli.run(project=project, args=['workspace', 'open', '--directory', workspace_dir, 'output-orphans.bst']) @@ -171,7 +171,7 @@ def test_filter_workspace_close(datafiles, cli, tmpdir): @pytest.mark.datafiles(os.path.join(DATA_DIR, 'basic')) def test_filter_workspace_reset(datafiles, cli, tmpdir): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) tempdir = os.path.join(tmpdir.dirname, tmpdir.basename) workspace_dir = os.path.join(tempdir, "workspace") result = cli.run(project=project, args=['workspace', 'open', '--directory', workspace_dir, 'output-orphans.bst']) @@ -474,7 +474,7 @@ def test_filter_track_multi_exclude(datafiles, cli, tmpdir): @pytest.mark.datafiles(os.path.join(DATA_DIR, 'basic')) def test_filter_include_with_indirect_deps(datafiles, cli, tmpdir): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) result = cli.run(project=project, args=[ 'build', 'output-include-with-indirect-deps.bst']) result.assert_success() @@ -494,7 +494,7 @@ def test_filter_include_with_indirect_deps(datafiles, cli, tmpdir): @pytest.mark.datafiles(os.path.join(DATA_DIR, 'basic')) def test_filter_fails_for_nonexisting_domain(datafiles, cli): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) result = cli.run(project=project, args=['build', 'output-include-nonexistent-domain.bst']) result.assert_main_error(ErrorDomain.STREAM, None) diff --git a/tests/examples/autotools.py b/tests/examples/autotools.py index 8a411b7a3..9aeafa510 100644 --- a/tests/examples/autotools.py +++ b/tests/examples/autotools.py @@ -21,7 +21,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_autotools_build(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) checkout = os.path.join(cli.directory, 'checkout') # Check that the project can be built correctly. @@ -44,7 +44,7 @@ def test_autotools_build(cli, datafiles): @pytest.mark.skipif(not IS_LINUX or not HAVE_BWRAP, reason='Only available on linux with bubblewrap') @pytest.mark.datafiles(DATA_DIR) def test_autotools_run(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) result = cli.run(project=project, args=['build', 'hello.bst']) result.assert_success() diff --git a/tests/examples/developing.py b/tests/examples/developing.py index 7da97931a..e12787f95 100644 --- a/tests/examples/developing.py +++ b/tests/examples/developing.py @@ -22,7 +22,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_autotools_build(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) checkout = os.path.join(cli.directory, 'checkout') # Check that the project can be built correctly. @@ -43,7 +43,7 @@ def test_autotools_build(cli, datafiles): @pytest.mark.skipif(not IS_LINUX or not HAVE_BWRAP, reason='Only available on linux with bubblewrap') @pytest.mark.datafiles(DATA_DIR) def test_run_unmodified_hello(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) result = cli.run(project=project, args=['build', 'hello.bst']) result.assert_success() @@ -57,7 +57,7 @@ def test_run_unmodified_hello(cli, datafiles): @pytest.mark.skipif(not IS_LINUX, reason='Only available on linux') @pytest.mark.datafiles(DATA_DIR) def test_open_workspace(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + 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', ]) @@ -76,7 +76,7 @@ def test_open_workspace(cli, tmpdir, datafiles): @pytest.mark.skipif(not IS_LINUX or not HAVE_BWRAP, reason='Only available on linux with bubblewrap') @pytest.mark.datafiles(DATA_DIR) def test_make_change_in_workspace(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + 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']) diff --git a/tests/examples/first-project.py b/tests/examples/first-project.py index 0956673fb..4d1e29d31 100644 --- a/tests/examples/first-project.py +++ b/tests/examples/first-project.py @@ -20,7 +20,7 @@ DATA_DIR = os.path.join( @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 = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) checkout = os.path.join(cli.directory, 'checkout') result = cli.run(project=project, args=['build', 'hello.bst']) diff --git a/tests/examples/flatpak-autotools.py b/tests/examples/flatpak-autotools.py index 410e6c5ee..647cd788f 100644 --- a/tests/examples/flatpak-autotools.py +++ b/tests/examples/flatpak-autotools.py @@ -40,7 +40,7 @@ def workaround_setuptools_bug(project): @pytest.mark.skipif(not IS_LINUX or not HAVE_OSTREE, reason='Only available on linux with ostree') @pytest.mark.datafiles(DATA_DIR) def test_autotools_build(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) checkout = os.path.join(cli.directory, 'checkout') workaround_setuptools_bug(project) @@ -63,7 +63,7 @@ def test_autotools_build(cli, datafiles): @pytest.mark.skipif(not IS_LINUX or not HAVE_OSTREE, reason='Only available on linux with ostree') @pytest.mark.datafiles(DATA_DIR) def test_autotools_run(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) workaround_setuptools_bug(project) result = cli.run(project=project, args=['build', 'hello.bst']) diff --git a/tests/examples/integration-commands.py b/tests/examples/integration-commands.py index 542fc8bed..053447956 100644 --- a/tests/examples/integration-commands.py +++ b/tests/examples/integration-commands.py @@ -19,7 +19,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_integration_commands_build(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) result = cli.run(project=project, args=['build', 'hello.bst']) assert result.exit_code == 0 @@ -31,7 +31,7 @@ def test_integration_commands_build(cli, datafiles): @pytest.mark.skipif(not IS_LINUX or not HAVE_BWRAP, reason='Only available on linux with bubblewrap') @pytest.mark.datafiles(DATA_DIR) def test_integration_commands_run(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) result = cli.run(project=project, args=['build', 'hello.bst']) assert result.exit_code == 0 diff --git a/tests/examples/junctions.py b/tests/examples/junctions.py index 621ca1c17..4bd72d8a3 100644 --- a/tests/examples/junctions.py +++ b/tests/examples/junctions.py @@ -20,7 +20,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(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) result = cli.run(project=project, args=['build', 'callHello.bst']) result.assert_success() @@ -32,7 +32,7 @@ def test_build(cli, datafiles): @pytest.mark.skipif(not IS_LINUX or not HAVE_BWRAP, reason='Only available on linux with bubblewrap') @pytest.mark.datafiles(DATA_DIR) def test_shell_call_hello(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) result = cli.run(project=project, args=['build', 'callHello.bst']) result.assert_success() @@ -46,7 +46,7 @@ def test_shell_call_hello(cli, datafiles): @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 = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) workspace_dir = os.path.join(str(tmpdir), "workspace_hello_junction") result = cli.run(project=project, diff --git a/tests/examples/running-commands.py b/tests/examples/running-commands.py index 0623d5a44..f201d2fa8 100644 --- a/tests/examples/running-commands.py +++ b/tests/examples/running-commands.py @@ -19,7 +19,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_running_commands_build(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) result = cli.run(project=project, args=['build', 'hello.bst']) assert result.exit_code == 0 @@ -31,7 +31,7 @@ def test_running_commands_build(cli, datafiles): @pytest.mark.skipif(not IS_LINUX or not HAVE_BWRAP, reason='Only available on linux with bubblewrap') @pytest.mark.datafiles(DATA_DIR) def test_running_commands_run(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) result = cli.run(project=project, args=['build', 'hello.bst']) assert result.exit_code == 0 diff --git a/tests/format/assertion.py b/tests/format/assertion.py index 8e112658f..cfab105b6 100644 --- a/tests/format/assertion.py +++ b/tests/format/assertion.py @@ -23,7 +23,7 @@ DATA_DIR = os.path.join( ('ordered-assertion.bst', 'True', 'True', "It's not horsy time yet"), ]) def test_assertion_cli(cli, datafiles, target, opt_pony, opt_horsy, assertion): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) result = cli.run(project=project, silent=True, args=[ '--option', 'pony', opt_pony, '--option', 'horsy', opt_horsy, diff --git a/tests/format/project.py b/tests/format/project.py index 031c5540a..b9b5898be 100644 --- a/tests/format/project.py +++ b/tests/format/project.py @@ -19,7 +19,7 @@ DATA_DIR = os.path.join( @pytest.mark.datafiles(os.path.join(DATA_DIR)) def test_missing_project_conf(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) result = cli.run(project=project, args=['workspace', 'list']) result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.MISSING_PROJECT_CONF) @@ -124,7 +124,7 @@ def test_project_unsupported(cli, datafiles): @pytest.mark.datafiles(os.path.join(DATA_DIR, 'element-path')) def test_missing_element_path_directory(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) result = cli.run(project=project, args=['workspace', 'list']) result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.MISSING_FILE) @@ -132,7 +132,7 @@ def test_missing_element_path_directory(cli, datafiles): @pytest.mark.datafiles(os.path.join(DATA_DIR, 'element-path')) def test_element_path_not_a_directory(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) path = os.path.join(project, 'elements') for _file_type in filetypegenerator.generate_file_types(path): result = cli.run(project=project, args=['workspace', 'list']) @@ -145,7 +145,7 @@ def test_element_path_not_a_directory(cli, datafiles): @pytest.mark.datafiles(os.path.join(DATA_DIR, 'local-plugin')) def test_missing_local_plugin_directory(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) result = cli.run(project=project, args=['workspace', 'list']) result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.MISSING_FILE) @@ -153,7 +153,7 @@ def test_missing_local_plugin_directory(cli, datafiles): @pytest.mark.datafiles(os.path.join(DATA_DIR, 'local-plugin')) def test_local_plugin_not_directory(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) path = os.path.join(project, 'plugins') for _file_type in filetypegenerator.generate_file_types(path): result = cli.run(project=project, args=['workspace', 'list']) diff --git a/tests/format/variables.py b/tests/format/variables.py index 928ad24ec..fe8d8ae8a 100644 --- a/tests/format/variables.py +++ b/tests/format/variables.py @@ -43,7 +43,7 @@ def print_warning(msg): ]) @pytest.mark.datafiles(os.path.join(DATA_DIR, 'defaults')) def test_defaults(cli, datafiles, target, varname, expected): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) result = cli.run(project=project, silent=True, args=[ 'show', '--deps', 'none', '--format', '%{vars}', target ]) @@ -69,7 +69,7 @@ def test_defaults(cli, datafiles, target, varname, expected): ]) @pytest.mark.datafiles(os.path.join(DATA_DIR, 'overrides')) def test_overrides(cli, datafiles, target, varname, expected): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) result = cli.run(project=project, silent=True, args=[ 'show', '--deps', 'none', '--format', '%{vars}', target ]) @@ -80,7 +80,7 @@ def test_overrides(cli, datafiles, target, varname, expected): @pytest.mark.datafiles(os.path.join(DATA_DIR, 'missing_variables')) def test_missing_variable(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) result = cli.run(project=project, silent=True, args=[ 'show', '--deps', 'none', '--format', '%{config}', 'manual.bst' ]) @@ -93,7 +93,7 @@ def test_missing_variable(cli, datafiles): def test_cyclic_variables(cli, datafiles): print_warning("Performing cyclic test, if this test times out it will " + "exit the test sequence") - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) result = cli.run(project=project, silent=True, args=[ "build", "cyclic.bst" ]) diff --git a/tests/frontend/artifact.py b/tests/frontend/artifact.py index 7ce9c337c..eadc6d443 100644 --- a/tests/frontend/artifact.py +++ b/tests/frontend/artifact.py @@ -37,7 +37,7 @@ DATA_DIR = os.path.join( @pytest.mark.datafiles(DATA_DIR) def test_artifact_log(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) # Get the cache key of our test element result = cli.run(project=project, silent=True, args=[ @@ -72,7 +72,7 @@ def test_artifact_log(cli, datafiles): # to the current project state @pytest.mark.datafiles(DATA_DIR) def test_artifact_delete_element(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) element = 'target.bst' # Build the element and ensure it's cached @@ -88,7 +88,7 @@ def test_artifact_delete_element(cli, tmpdir, datafiles): # Test that we can delete an artifact by specifying its ref. @pytest.mark.datafiles(DATA_DIR) def test_artifact_delete_artifact(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) element = 'target.bst' # Configure a local cache @@ -117,7 +117,7 @@ def test_artifact_delete_artifact(cli, tmpdir, datafiles): # Test the `bst artifact delete` command with multiple, different arguments. @pytest.mark.datafiles(DATA_DIR) def test_artifact_delete_element_and_artifact(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) element = 'target.bst' dep = 'compose-all.bst' @@ -153,7 +153,7 @@ def test_artifact_delete_element_and_artifact(cli, tmpdir, datafiles): # that is not present in the cache. @pytest.mark.datafiles(DATA_DIR) def test_artifact_delete_unbuilt_artifact(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) element = 'target.bst' # delete it, just in case it's there @@ -175,7 +175,7 @@ def test_artifact_delete_unbuilt_artifact(cli, tmpdir, datafiles): # throw an Exception when trying to prune the cache. @pytest.mark.datafiles(DATA_DIR) def test_artifact_delete_pulled_artifact_without_buildtree(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) element = 'target.bst' # Set up remote and local shares diff --git a/tests/frontend/buildcheckout.py b/tests/frontend/buildcheckout.py index a0af90b58..dc3c5e4d4 100644 --- a/tests/frontend/buildcheckout.py +++ b/tests/frontend/buildcheckout.py @@ -38,7 +38,7 @@ def strict_args(args, strict): ("non-strict", "hardlinks"), ]) def test_build_checkout(datafiles, cli, strict, hardlinks): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) checkout = os.path.join(cli.directory, 'checkout') # First build it @@ -70,7 +70,7 @@ def test_build_checkout(datafiles, cli, strict, hardlinks): @pytest.mark.datafiles(DATA_DIR + "_world") def test_build_default_all(datafiles, cli): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) result = cli.run(project=project, silent=True, args=['build']) result.assert_success() @@ -88,7 +88,7 @@ def test_build_default_all(datafiles, cli): @pytest.mark.datafiles(DATA_DIR + "_default") def test_build_default(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) result = cli.run(project=project, silent=True, args=['build']) result.assert_success() @@ -102,7 +102,7 @@ def test_build_default(cli, datafiles): ("non-strict", "hardlinks"), ]) def test_build_invalid_suffix(datafiles, cli, strict, hardlinks): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) result = cli.run(project=project, args=strict_args(['build', 'target.foo'], strict)) result.assert_main_error(ErrorDomain.LOAD, "bad-element-suffix") @@ -113,7 +113,7 @@ def test_build_invalid_suffix(datafiles, cli, strict, hardlinks): ("non-strict", "hardlinks"), ]) def test_build_invalid_suffix_dep(datafiles, cli, strict, hardlinks): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) # target2.bst depends on an element called target.foo result = cli.run(project=project, args=strict_args(['build', 'target2.bst'], strict)) @@ -123,7 +123,7 @@ def test_build_invalid_suffix_dep(datafiles, cli, strict, hardlinks): @pytest.mark.skipif(IS_WINDOWS, reason='Not available on Windows') @pytest.mark.datafiles(DATA_DIR) def test_build_invalid_filename_chars(datafiles, cli): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) element_name = 'invalid-chars|<>-in-name.bst' # The name of this file contains characters that are not allowed by @@ -140,7 +140,7 @@ def test_build_invalid_filename_chars(datafiles, cli): @pytest.mark.skipif(IS_WINDOWS, reason='Not available on Windows') @pytest.mark.datafiles(DATA_DIR) def test_build_invalid_filename_chars_dep(datafiles, cli): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) element_name = 'invalid-chars|<>-in-name.bst' # The name of this file contains characters that are not allowed by @@ -158,7 +158,7 @@ def test_build_invalid_filename_chars_dep(datafiles, cli): @pytest.mark.datafiles(DATA_DIR) @pytest.mark.parametrize("deps", [("run"), ("none"), ("build")]) def test_build_checkout_deps(datafiles, cli, deps): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) checkout = os.path.join(cli.directory, 'checkout') element_name = "checkout-deps.bst" @@ -200,7 +200,7 @@ def test_build_checkout_deps(datafiles, cli, deps): @pytest.mark.datafiles(DATA_DIR) def test_build_checkout_unbuilt(datafiles, cli): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) checkout = os.path.join(cli.directory, 'checkout') # Check that checking out an unbuilt element fails nicely @@ -210,7 +210,7 @@ def test_build_checkout_unbuilt(datafiles, cli): @pytest.mark.datafiles(DATA_DIR) def test_build_checkout_tarball(datafiles, cli): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) checkout = os.path.join(cli.directory, 'checkout.tar') result = cli.run(project=project, args=['build', 'target.bst']) @@ -232,7 +232,7 @@ def test_build_checkout_tarball(datafiles, cli): @pytest.mark.datafiles(DATA_DIR) def test_build_checkout_tarball_stdout(datafiles, cli): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) tarball = os.path.join(cli.directory, 'tarball.tar') result = cli.run(project=project, args=['build', 'target.bst']) @@ -257,7 +257,7 @@ def test_build_checkout_tarball_stdout(datafiles, cli): @pytest.mark.datafiles(DATA_DIR) def test_build_checkout_tarball_mtime_nonzero(datafiles, cli): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) tarpath = os.path.join(cli.directory, 'mtime_tar.tar') result = cli.run(project=project, args=['build', 'target.bst']) @@ -277,7 +277,7 @@ def test_build_checkout_tarball_mtime_nonzero(datafiles, cli): @pytest.mark.datafiles(DATA_DIR) def test_build_checkout_tarball_is_deterministic(datafiles, cli): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) tarball1 = os.path.join(cli.directory, 'tarball1.tar') tarball2 = os.path.join(cli.directory, 'tarball2.tar') @@ -312,7 +312,7 @@ def test_build_checkout_tarball_is_deterministic(datafiles, cli): @pytest.mark.datafiles(DATA_DIR) @pytest.mark.parametrize("hardlinks", [("copies"), ("hardlinks")]) def test_build_checkout_nonempty(datafiles, cli, hardlinks): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) checkout = os.path.join(cli.directory, 'checkout') filename = os.path.join(checkout, "file.txt") @@ -344,7 +344,7 @@ def test_build_checkout_nonempty(datafiles, cli, hardlinks): @pytest.mark.datafiles(DATA_DIR) @pytest.mark.parametrize("hardlinks", [("copies"), ("hardlinks")]) def test_build_checkout_force(datafiles, cli, hardlinks): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) checkout = os.path.join(cli.directory, 'checkout') filename = os.path.join(checkout, "file.txt") @@ -387,7 +387,7 @@ def test_build_checkout_force(datafiles, cli, hardlinks): @pytest.mark.datafiles(DATA_DIR) def test_build_checkout_force_tarball(datafiles, cli): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) tarball = os.path.join(cli.directory, 'tarball.tar') result = cli.run(project=project, args=['build', 'target.bst']) @@ -412,7 +412,7 @@ def test_build_checkout_force_tarball(datafiles, cli): @pytest.mark.datafiles(DATA_DIR) def test_install_to_build(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) element = 'installed-to-build.bst' # Attempt building the element @@ -427,7 +427,7 @@ def test_install_to_build(cli, datafiles): @pytest.mark.datafiles(DATA_DIR) @pytest.mark.parametrize("ref_storage", [('inline'), ('project.refs')]) def test_inconsistent_junction(cli, tmpdir, datafiles, ref_storage): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) subproject_path = os.path.join(project, 'files', 'sub-project') junction_path = os.path.join(project, 'elements', 'junction.bst') element_path = os.path.join(project, 'elements', 'junction-dep.bst') @@ -461,7 +461,7 @@ def test_inconsistent_junction(cli, tmpdir, datafiles, ref_storage): @pytest.mark.datafiles(DATA_DIR) @pytest.mark.parametrize("ref_storage", [('inline'), ('project.refs')]) def test_unfetched_junction(cli, tmpdir, datafiles, ref_storage): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) subproject_path = os.path.join(project, 'files', 'sub-project') junction_path = os.path.join(project, 'elements', 'junction.bst') element_path = os.path.join(project, 'elements', 'junction-dep.bst') @@ -513,7 +513,7 @@ def test_unfetched_junction(cli, tmpdir, datafiles, ref_storage): @pytest.mark.datafiles(DATA_DIR) def test_build_checkout_junction(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) subproject_path = os.path.join(project, 'files', 'sub-project') junction_path = os.path.join(project, 'elements', 'junction.bst') element_path = os.path.join(project, 'elements', 'junction-dep.bst') @@ -560,7 +560,7 @@ def test_build_checkout_junction(cli, tmpdir, datafiles): # Test that default targets work with projects with junctions @pytest.mark.datafiles(DATA_DIR + "_world") def test_build_checkout_junction_default_targets(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) subproject_path = os.path.join(project, 'files', 'sub-project') junction_path = os.path.join(project, 'elements', 'junction.bst') element_path = os.path.join(project, 'elements', 'junction-dep.bst') @@ -606,7 +606,7 @@ def test_build_checkout_junction_default_targets(cli, tmpdir, datafiles): @pytest.mark.datafiles(DATA_DIR) def test_build_checkout_workspaced_junction(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) subproject_path = os.path.join(project, 'files', 'sub-project') junction_path = os.path.join(project, 'elements', 'junction.bst') element_path = os.path.join(project, 'elements', 'junction-dep.bst') @@ -669,7 +669,7 @@ def test_build_checkout_workspaced_junction(cli, tmpdir, datafiles): @pytest.mark.datafiles(DATA_DIR) def test_build_checkout_cross_junction(datafiles, cli, tmpdir): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) subproject_path = os.path.join(project, 'files', 'sub-project') junction_path = os.path.join(project, 'elements', 'junction.bst') checkout = os.path.join(cli.directory, 'checkout') @@ -689,7 +689,7 @@ def test_build_checkout_cross_junction(datafiles, cli, tmpdir): @pytest.mark.datafiles(DATA_DIR) def test_build_junction_short_notation(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) subproject_path = os.path.join(project, 'files', 'sub-project') junction_path = os.path.join(project, 'elements', 'junction.bst') element_path = os.path.join(project, 'elements', 'junction-dep.bst') @@ -730,7 +730,7 @@ def test_build_junction_short_notation(cli, tmpdir, datafiles): @pytest.mark.datafiles(DATA_DIR) def test_build_junction_short_notation_filename(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) subproject_path = os.path.join(project, 'files', 'sub-project') junction_path = os.path.join(project, 'elements', 'junction.bst') element_path = os.path.join(project, 'elements', 'junction-dep.bst') @@ -771,7 +771,7 @@ def test_build_junction_short_notation_filename(cli, tmpdir, datafiles): @pytest.mark.datafiles(DATA_DIR) def test_build_junction_short_notation_with_junction(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) subproject_path = os.path.join(project, 'files', 'sub-project') junction_path = os.path.join(project, 'elements', 'junction.bst') element_path = os.path.join(project, 'elements', 'junction-dep.bst') @@ -798,7 +798,7 @@ def test_build_junction_short_notation_with_junction(cli, tmpdir, datafiles): @pytest.mark.datafiles(DATA_DIR) def test_build_junction_transitive_short_notation_with_junction(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) subproject_path = os.path.join(project, 'files', 'sub-project') junction_path = os.path.join(project, 'elements', 'junction.bst') element_path = os.path.join(project, 'elements', 'junction-dep.bst') diff --git a/tests/frontend/buildtrack.py b/tests/frontend/buildtrack.py index 89024e96b..2d8d0e383 100644 --- a/tests/frontend/buildtrack.py +++ b/tests/frontend/buildtrack.py @@ -54,7 +54,7 @@ def create_element(repo, name, path, dependencies, ref=None): ]) def test_build_track(cli, datafiles, tmpdir, ref_storage, track_targets, exceptions, tracked): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) dev_files_path = os.path.join(project, 'files', 'dev-files') element_path = os.path.join(project, 'elements') @@ -164,7 +164,7 @@ def test_build_track(cli, datafiles, tmpdir, ref_storage, ]) def test_build_track_update(cli, datafiles, tmpdir, track_targets, exceptions, tracked): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) dev_files_path = os.path.join(project, 'files', 'dev-files') element_path = os.path.join(project, 'elements') @@ -221,7 +221,7 @@ def test_build_track_update(cli, datafiles, tmpdir, track_targets, ]) def test_build_track_inconsistent(cli, datafiles, tmpdir, track_targets, exceptions): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) dev_files_path = os.path.join(project, 'files', 'dev-files') element_path = os.path.join(project, 'elements') @@ -267,7 +267,7 @@ def test_build_track_inconsistent(cli, datafiles, tmpdir, @pytest.mark.datafiles(os.path.join(DATA_DIR)) @pytest.mark.parametrize("strict", ['--strict', '--no-strict']) def test_build_track_track_first(cli, datafiles, tmpdir, strict): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) dev_files_path = os.path.join(project, 'files', 'dev-files') element_path = os.path.join(project, 'elements') diff --git a/tests/frontend/completions.py b/tests/frontend/completions.py index 8e4a85dab..3876dcf15 100644 --- a/tests/frontend/completions.py +++ b/tests/frontend/completions.py @@ -300,7 +300,7 @@ def test_help_commands(cli, cmd, word_idx, expected): @pytest.mark.datafiles(os.path.join(DATA_DIR, 'project')) def test_argument_artifact(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) # Build an import element with no dependencies (as there will only be ONE cache key) result = cli.run(project=project, args=['build', 'import-bin.bst']) # Has no dependencies diff --git a/tests/frontend/compose_splits.py b/tests/frontend/compose_splits.py index ecce1dd72..adce813bd 100644 --- a/tests/frontend/compose_splits.py +++ b/tests/frontend/compose_splits.py @@ -18,7 +18,7 @@ DATA_DIR = os.path.join( ]) @pytest.mark.datafiles(DATA_DIR) def test_compose_splits(datafiles, cli, target): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) checkout = os.path.join(cli.directory, 'checkout') # First build it diff --git a/tests/frontend/configurable_warnings.py b/tests/frontend/configurable_warnings.py index b44a1a1c1..fe522f33a 100644 --- a/tests/frontend/configurable_warnings.py +++ b/tests/frontend/configurable_warnings.py @@ -36,7 +36,7 @@ def get_project(fatal_warnings): def build_project(datafiles, fatal_warnings): - project_path = os.path.join(datafiles.dirname, datafiles.basename) + project_path = str(datafiles) project = get_project(fatal_warnings) diff --git a/tests/frontend/fetch.py b/tests/frontend/fetch.py index ca67ca376..1a2c40602 100644 --- a/tests/frontend/fetch.py +++ b/tests/frontend/fetch.py @@ -19,7 +19,7 @@ DATA_DIR = os.path.join(TOP_DIR, 'project') @pytest.mark.datafiles(os.path.join(TOP_DIR, 'project_world')) def test_fetch_default_targets(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) element_path = os.path.join(project, 'elements') element_name = 'fetch-test.bst' @@ -54,7 +54,7 @@ def test_fetch_default_targets(cli, tmpdir, datafiles): @pytest.mark.datafiles(os.path.join(TOP_DIR, 'consistencyerror')) def test_fetch_consistency_error(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) # When the error occurs outside of the scheduler at load time, # then the SourceError is reported directly as the main error. @@ -64,7 +64,7 @@ def test_fetch_consistency_error(cli, datafiles): @pytest.mark.datafiles(os.path.join(TOP_DIR, 'consistencyerror')) def test_fetch_consistency_bug(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) # FIXME: # @@ -81,7 +81,7 @@ def test_fetch_consistency_bug(cli, datafiles): @pytest.mark.datafiles(DATA_DIR) @pytest.mark.parametrize("ref_storage", [('inline'), ('project.refs')]) def test_unfetched_junction(cli, tmpdir, datafiles, ref_storage): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) subproject_path = os.path.join(project, 'files', 'sub-project') junction_path = os.path.join(project, 'elements', 'junction.bst') element_path = os.path.join(project, 'elements', 'junction-dep.bst') @@ -131,7 +131,7 @@ def test_unfetched_junction(cli, tmpdir, datafiles, ref_storage): @pytest.mark.datafiles(DATA_DIR) @pytest.mark.parametrize("ref_storage", [('inline'), ('project.refs')]) def test_inconsistent_junction(cli, tmpdir, datafiles, ref_storage): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) subproject_path = os.path.join(project, 'files', 'sub-project') junction_path = os.path.join(project, 'elements', 'junction.bst') element_path = os.path.join(project, 'elements', 'junction-dep.bst') diff --git a/tests/frontend/logging.py b/tests/frontend/logging.py index 322e1490b..4036a4693 100644 --- a/tests/frontend/logging.py +++ b/tests/frontend/logging.py @@ -21,7 +21,7 @@ DATA_DIR = os.path.join( @pytest.mark.datafiles(DATA_DIR) def test_default_logging(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) bin_files_path = os.path.join(project, 'files', 'bin-files') element_path = os.path.join(project, 'elements') element_name = 'fetch-test-git.bst' @@ -53,7 +53,7 @@ def test_default_logging(cli, tmpdir, datafiles): @pytest.mark.datafiles(DATA_DIR) def test_custom_logging(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) bin_files_path = os.path.join(project, 'files', 'bin-files') element_path = os.path.join(project, 'elements') element_name = 'fetch-test-git.bst' @@ -91,7 +91,7 @@ def test_custom_logging(cli, tmpdir, datafiles): @pytest.mark.datafiles(DATA_DIR) def test_failed_build_listing(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) element_names = [] for i in range(3): element_name = 'testfail-{}.bst'.format(i) diff --git a/tests/frontend/order.py b/tests/frontend/order.py index 4f5d5654f..cd75aa6b7 100644 --- a/tests/frontend/order.py +++ b/tests/frontend/order.py @@ -77,7 +77,7 @@ def create_element(project, name, dependencies): ]) @pytest.mark.parametrize("operation", [('show'), ('fetch'), ('build')]) def test_order(cli, datafiles, operation, target, template, expected): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) # Configure to only allow one fetcher at a time, make it easy to # determine what is being planned in what order. diff --git a/tests/frontend/pull.py b/tests/frontend/pull.py index faaa87ba0..950fd90fc 100644 --- a/tests/frontend/pull.py +++ b/tests/frontend/pull.py @@ -47,7 +47,7 @@ def assert_not_shared(cli, share, project, element_name): # @pytest.mark.datafiles(DATA_DIR) def test_push_pull_all(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) with create_artifact_share(os.path.join(str(tmpdir), 'artifactshare')) as share: @@ -90,7 +90,7 @@ def test_push_pull_all(cli, tmpdir, datafiles): # @pytest.mark.datafiles(DATA_DIR + '_world') def test_push_pull_default_targets(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) with create_artifact_share(os.path.join(str(tmpdir), 'artifactshare')) as share: @@ -140,7 +140,7 @@ def test_push_pull_default_targets(cli, tmpdir, datafiles): # @pytest.mark.datafiles(DATA_DIR) def test_pull_secondary_cache(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) with create_artifact_share(os.path.join(str(tmpdir), 'artifactshare1')) as share1,\ create_artifact_share(os.path.join(str(tmpdir), 'artifactshare2')) as share2: @@ -181,7 +181,7 @@ def test_pull_secondary_cache(cli, tmpdir, datafiles): # @pytest.mark.datafiles(DATA_DIR) def test_push_pull_specific_remote(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) with create_artifact_share(os.path.join(str(tmpdir), 'goodartifactshare')) as good_share,\ create_artifact_share(os.path.join(str(tmpdir), 'badartifactshare')) as bad_share: @@ -230,7 +230,7 @@ def test_push_pull_specific_remote(cli, tmpdir, datafiles): # @pytest.mark.datafiles(DATA_DIR) def test_push_pull_non_strict(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) with create_artifact_share(os.path.join(str(tmpdir), 'artifactshare')) as share: # First build the target element and push to the remote. @@ -279,7 +279,7 @@ def test_push_pull_non_strict(cli, tmpdir, datafiles): # Regression test for https://gitlab.com/BuildStream/buildstream/issues/202 @pytest.mark.datafiles(DATA_DIR) def test_push_pull_track_non_strict(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) with create_artifact_share(os.path.join(str(tmpdir), 'artifactshare')) as share: @@ -322,7 +322,7 @@ def test_push_pull_track_non_strict(cli, tmpdir, datafiles): @pytest.mark.datafiles(DATA_DIR) def test_push_pull_cross_junction(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) with create_artifact_share(os.path.join(str(tmpdir), 'artifactshare')) as share: subproject_path = os.path.join(project, 'files', 'sub-project') @@ -353,7 +353,7 @@ def test_push_pull_cross_junction(cli, tmpdir, datafiles): @pytest.mark.datafiles(DATA_DIR) def test_pull_missing_blob(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) with create_artifact_share(os.path.join(str(tmpdir), 'artifactshare')) as share: @@ -395,7 +395,7 @@ def test_pull_missing_blob(cli, tmpdir, datafiles): @pytest.mark.datafiles(DATA_DIR) def test_pull_missing_notifies_user(caplog, cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) caplog.set_level(1) with create_artifact_share(os.path.join(str(tmpdir), 'artifactshare')) as share: @@ -415,7 +415,7 @@ def test_pull_missing_notifies_user(caplog, cli, tmpdir, datafiles): @pytest.mark.datafiles(DATA_DIR) def test_build_remote_option(caplog, cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) caplog.set_level(1) with create_artifact_share(os.path.join(str(tmpdir), 'artifactshare1')) as shareuser,\ diff --git a/tests/frontend/push.py b/tests/frontend/push.py index ab6b455f2..919ce3a84 100644 --- a/tests/frontend/push.py +++ b/tests/frontend/push.py @@ -126,7 +126,7 @@ def test_push(cli, tmpdir, datafiles): # @pytest.mark.datafiles(DATA_DIR) def test_push_all(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) with create_artifact_share(os.path.join(str(tmpdir), 'artifactshare')) as share: @@ -175,7 +175,7 @@ def test_push_all(cli, tmpdir, datafiles): # Regression test for https://gitlab.com/BuildStream/buildstream/issues/233. @pytest.mark.datafiles(DATA_DIR) def test_push_after_pull(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) # Set up two artifact shares. with create_artifact_share(os.path.join(str(tmpdir), 'artifactshare1')) as share1,\ @@ -226,7 +226,7 @@ def test_push_after_pull(cli, tmpdir, datafiles): # the incoming artifact. @pytest.mark.datafiles(DATA_DIR) def test_artifact_expires(cli, datafiles, tmpdir): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) element_path = 'elements' # Create an artifact share (remote artifact cache) in the tmpdir/artifactshare @@ -277,7 +277,7 @@ def test_artifact_expires(cli, datafiles, tmpdir): # to the remote share @pytest.mark.datafiles(DATA_DIR) def test_artifact_too_large(cli, datafiles, tmpdir): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) element_path = 'elements' # Create an artifact share (remote cache) in tmpdir/artifactshare @@ -313,7 +313,7 @@ def test_artifact_too_large(cli, datafiles, tmpdir): # Test that when an element is pulled recently, it is not considered the LRU element. @pytest.mark.datafiles(DATA_DIR) def test_recently_pulled_artifact_does_not_expire(cli, datafiles, tmpdir): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) element_path = 'elements' # Create an artifact share (remote cache) in tmpdir/artifactshare @@ -399,7 +399,7 @@ def test_push_cross_junction(cli, tmpdir, datafiles): @pytest.mark.datafiles(DATA_DIR) def test_push_already_cached(caplog, cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) caplog.set_level(1) with create_artifact_share(os.path.join(str(tmpdir), 'artifactshare')) as share: @@ -422,7 +422,7 @@ def test_push_already_cached(caplog, cli, tmpdir, datafiles): @pytest.mark.datafiles(DATA_DIR) def test_build_remote_option(caplog, cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) caplog.set_level(1) with create_artifact_share(os.path.join(str(tmpdir), 'artifactshare1')) as shareuser,\ diff --git a/tests/frontend/rebuild.py b/tests/frontend/rebuild.py index 67eab9bde..cf517f3c1 100644 --- a/tests/frontend/rebuild.py +++ b/tests/frontend/rebuild.py @@ -21,7 +21,7 @@ def strict_args(args, strict): @pytest.mark.datafiles(DATA_DIR) @pytest.mark.parametrize("strict", ["strict", "non-strict"]) def test_rebuild(datafiles, cli, strict): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) # First build intermediate target.bst result = cli.run(project=project, args=strict_args(['build', 'target.bst'], strict)) diff --git a/tests/frontend/show.py b/tests/frontend/show.py index a95a2d529..bb2fc2ee2 100644 --- a/tests/frontend/show.py +++ b/tests/frontend/show.py @@ -26,7 +26,7 @@ DATA_DIR = os.path.join( ('compose-all.bst', '%{state}', 'waiting') ]) def test_show(cli, datafiles, target, fmt, expected): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) result = cli.run(project=project, silent=True, args=[ 'show', '--deps', 'none', @@ -44,13 +44,13 @@ def test_show(cli, datafiles, target, fmt, expected): "invalid_element_path", )) def test_show_invalid_element_path(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) cli.run(project=project, silent=True, args=['show', "foo.bst"]) @pytest.mark.datafiles(os.path.join(DATA_DIR, 'project_default')) def test_show_default(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) result = cli.run(project=project, silent=True, args=[ 'show']) @@ -64,7 +64,7 @@ def test_show_default(cli, datafiles): @pytest.mark.datafiles(os.path.join(DATA_DIR, 'project_fail')) def test_show_fail(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) result = cli.run(project=project, silent=True, args=[ 'show']) @@ -79,7 +79,7 @@ def test_show_fail(cli, datafiles): ('compose-all.bst', 'import-bin.bst', ['import-dev.bst', 'compose-all.bst']) ]) def test_show_except_simple(cli, datafiles, target, except_, expected): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) result = cli.run(project=project, silent=True, args=[ 'show', '--deps', 'all', @@ -166,7 +166,7 @@ def test_show_except_simple(cli, datafiles, target, except_, expected): ]), ]) def test_show_except(cli, datafiles, targets, exceptions, expected): - basedir = os.path.join(datafiles.dirname, datafiles.basename) + basedir = str(datafiles) results = cli.get_pipeline(basedir, targets, except_=exceptions, scope='all') if results != expected: raise AssertionError("Expected elements:\n{}\nInstead received elements:\n{}" @@ -178,7 +178,7 @@ def test_show_except(cli, datafiles, targets, exceptions, expected): ############################################################### @pytest.mark.datafiles(os.path.join(DATA_DIR, 'project')) def test_parallel_order(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) elements = ['multiple_targets/order/0.bst', 'multiple_targets/order/1.bst'] @@ -207,7 +207,7 @@ def test_parallel_order(cli, datafiles): @pytest.mark.datafiles(os.path.join(DATA_DIR, 'project')) def test_target_is_dependency(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) elements = ['multiple_targets/dependency/zebry.bst', 'multiple_targets/dependency/horsey.bst'] @@ -227,7 +227,7 @@ def test_target_is_dependency(cli, datafiles): @pytest.mark.parametrize("ref_storage", [('inline'), ('project.refs')]) @pytest.mark.parametrize("element_name", ['junction-dep.bst', 'junction.bst:import-etc.bst']) def test_unfetched_junction(cli, tmpdir, datafiles, ref_storage, element_name): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) subproject_path = os.path.join(project, 'files', 'sub-project') junction_path = os.path.join(project, 'elements', 'junction.bst') element_path = os.path.join(project, 'elements', 'junction-dep.bst') @@ -279,7 +279,7 @@ def test_unfetched_junction(cli, tmpdir, datafiles, ref_storage, element_name): @pytest.mark.parametrize("ref_storage", [('inline'), ('project.refs')]) @pytest.mark.parametrize("element_name", ['junction-dep.bst', 'junction.bst:import-etc.bst']) def test_inconsistent_junction(cli, tmpdir, datafiles, ref_storage, element_name): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) subproject_path = os.path.join(project, 'files', 'sub-project') junction_path = os.path.join(project, 'elements', 'junction.bst') element_path = os.path.join(project, 'elements', 'junction-dep.bst') @@ -314,7 +314,7 @@ def test_inconsistent_junction(cli, tmpdir, datafiles, ref_storage, element_name @pytest.mark.datafiles(os.path.join(DATA_DIR, 'project')) @pytest.mark.parametrize("element_name", ['junction-dep.bst', 'junction.bst:import-etc.bst']) def test_fetched_junction(cli, tmpdir, datafiles, element_name): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) subproject_path = os.path.join(project, 'files', 'sub-project') junction_path = os.path.join(project, 'elements', 'junction.bst') element_path = os.path.join(project, 'elements', 'junction-dep.bst') @@ -413,7 +413,7 @@ def test_exceed_max_recursion_depth(cli, tmpdir, dependency_depth): ('%{runtime-deps}', '[import-bin.bst]') ]) def test_format_deps(cli, datafiles, dep_kind, expected_deps): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) target = 'checkout-deps.bst' result = cli.run(project=project, silent=True, args=[ 'show', diff --git a/tests/frontend/source_checkout.py b/tests/frontend/source_checkout.py index 6e21e2d87..c43bea6bd 100644 --- a/tests/frontend/source_checkout.py +++ b/tests/frontend/source_checkout.py @@ -40,7 +40,7 @@ def generate_remote_import_element(input_path, output_path): ) def test_source_checkout(datafiles, cli, tmpdir_factory, with_workspace, guess_element): tmpdir = tmpdir_factory.mktemp("") - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) checkout = os.path.join(cli.directory, 'source-checkout') target = 'checkout-deps.bst' workspace = os.path.join(str(tmpdir), 'workspace') @@ -63,7 +63,7 @@ def test_source_checkout(datafiles, cli, tmpdir_factory, with_workspace, guess_e @pytest.mark.datafiles(DATA_DIR) @pytest.mark.parametrize('force_flag', ['--force', '-f']) def test_source_checkout_force(datafiles, cli, force_flag): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) checkout = os.path.join(cli.directory, 'source-checkout') target = 'checkout-deps.bst' @@ -78,7 +78,7 @@ def test_source_checkout_force(datafiles, cli, force_flag): @pytest.mark.datafiles(DATA_DIR) def test_source_checkout_tar(datafiles, cli): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) checkout = os.path.join(cli.directory, 'source-checkout.tar') target = 'checkout-deps.bst' @@ -96,7 +96,7 @@ def test_source_checkout_tar(datafiles, cli): @pytest.mark.datafiles(DATA_DIR) @pytest.mark.parametrize('deps', [('build'), ('none'), ('run'), ('all')]) def test_source_checkout_deps(datafiles, cli, deps): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) checkout = os.path.join(cli.directory, 'source-checkout') target = 'checkout-deps.bst' @@ -124,7 +124,7 @@ def test_source_checkout_deps(datafiles, cli, deps): @pytest.mark.datafiles(DATA_DIR) def test_source_checkout_except(datafiles, cli): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) checkout = os.path.join(cli.directory, 'source-checkout') target = 'checkout-deps.bst' @@ -147,7 +147,7 @@ def test_source_checkout_except(datafiles, cli): @pytest.mark.datafiles(DATA_DIR) @pytest.mark.parametrize('fetch', [(False), (True)]) def test_source_checkout_fetch(datafiles, cli, fetch): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) checkout = os.path.join(cli.directory, 'source-checkout') target = 'remote-import-dev.bst' target_path = os.path.join(project, 'elements', target) @@ -177,7 +177,7 @@ def test_source_checkout_fetch(datafiles, cli, fetch): @pytest.mark.datafiles(DATA_DIR) def test_source_checkout_build_scripts(cli, tmpdir, datafiles): - project_path = os.path.join(datafiles.dirname, datafiles.basename) + project_path = str(datafiles) element_name = 'source-bundle/source-bundle-hello.bst' normal_name = 'source-bundle-source-bundle-hello' checkout = os.path.join(str(tmpdir), 'source-checkout') @@ -194,7 +194,7 @@ def test_source_checkout_build_scripts(cli, tmpdir, datafiles): @pytest.mark.datafiles(DATA_DIR) def test_source_checkout_tar_buildscripts(cli, tmpdir, datafiles): - project_path = os.path.join(datafiles.dirname, datafiles.basename) + project_path = str(datafiles) element_name = 'source-bundle/source-bundle-hello.bst' normal_name = 'source-bundle-source-bundle-hello' tar_file = os.path.join(str(tmpdir), 'source-checkout.tar') diff --git a/tests/frontend/track.py b/tests/frontend/track.py index 2660b25de..b3b063f69 100644 --- a/tests/frontend/track.py +++ b/tests/frontend/track.py @@ -32,7 +32,7 @@ def generate_element(repo, element_path, dep_name=None): @pytest.mark.datafiles(DATA_DIR) def test_track_single(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) dev_files_path = os.path.join(project, 'files', 'dev-files') element_path = os.path.join(project, 'elements') element_dep_name = 'track-test-dep.bst' @@ -130,7 +130,7 @@ def test_track_optional(cli, tmpdir, datafiles, ref_storage): @pytest.mark.parametrize("cross_junction", [('cross'), ('nocross')]) @pytest.mark.parametrize("ref_storage", [('inline'), ('project.refs')]) def test_track_cross_junction(cli, tmpdir, datafiles, cross_junction, ref_storage): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) dev_files_path = os.path.join(project, 'files') target_path = os.path.join(project, 'target.bst') subtarget_path = os.path.join(project, 'subproject', 'subtarget.bst') @@ -218,7 +218,7 @@ def test_track_cross_junction(cli, tmpdir, datafiles, cross_junction, ref_storag @pytest.mark.datafiles(os.path.join(TOP_DIR, 'consistencyerror')) def test_track_consistency_error(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) # Track the element causing a consistency error result = cli.run(project=project, args=['source', 'track', 'error.bst']) @@ -228,7 +228,7 @@ def test_track_consistency_error(cli, datafiles): @pytest.mark.datafiles(os.path.join(TOP_DIR, 'consistencyerror')) def test_track_consistency_bug(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) # Track the element causing an unhandled exception result = cli.run(project=project, args=['source', 'track', 'bug.bst']) @@ -240,7 +240,7 @@ def test_track_consistency_bug(cli, datafiles): @pytest.mark.datafiles(DATA_DIR) @pytest.mark.parametrize("ref_storage", [('inline'), ('project.refs')]) def test_inconsistent_junction(cli, tmpdir, datafiles, ref_storage): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) subproject_path = os.path.join(project, 'files', 'sub-project') junction_path = os.path.join(project, 'elements', 'junction.bst') element_path = os.path.join(project, 'elements', 'junction-dep.bst') @@ -274,7 +274,7 @@ def test_inconsistent_junction(cli, tmpdir, datafiles, ref_storage): @pytest.mark.datafiles(DATA_DIR) @pytest.mark.parametrize("ref_storage", [('inline'), ('project.refs')]) def test_junction_element(cli, tmpdir, datafiles, ref_storage): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) subproject_path = os.path.join(project, 'files', 'sub-project') junction_path = os.path.join(project, 'elements', 'junction.bst') element_path = os.path.join(project, 'elements', 'junction-dep.bst') diff --git a/tests/frontend/workspace.py b/tests/frontend/workspace.py index e570c2899..204cfb7a8 100644 --- a/tests/frontend/workspace.py +++ b/tests/frontend/workspace.py @@ -58,9 +58,9 @@ class WorkspaceCreator(): self.datafiles = datafiles if not project_path: - project_path = os.path.join(datafiles.dirname, datafiles.basename) + project_path = str(datafiles) else: - shutil.copytree(os.path.join(datafiles.dirname, datafiles.basename), project_path) + shutil.copytree(str(datafiles), project_path) self.project_path = project_path self.bin_files_path = os.path.join(project_path, 'files', 'bin-files') @@ -672,7 +672,7 @@ def test_build(cli, tmpdir_factory, datafiles, kind, strict, from_workspace, gue @pytest.mark.datafiles(DATA_DIR) def test_buildable_no_ref(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) element_name = 'workspace-test-no-ref.bst' element_path = os.path.join(project, 'elements') @@ -801,7 +801,7 @@ def test_detect_modifications(cli, tmpdir, datafiles, modification, strict): {"format-version": BST_WORKSPACE_FORMAT_VERSION + 1} ]) def test_list_unsupported_workspace(cli, datafiles, workspace_cfg): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) os.makedirs(os.path.join(project, '.bst')) workspace_config_path = os.path.join(project, '.bst', 'workspaces.yml') @@ -913,7 +913,7 @@ def test_list_supported_workspace(cli, tmpdir, datafiles, workspace_cfg, expecte _yaml.dump(node, tempfile) return _yaml.node_sanitize(_yaml.load(tempfile)) - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) os.makedirs(os.path.join(project, '.bst')) workspace_config_path = os.path.join(project, '.bst', 'workspaces.yml') 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' diff --git a/tests/internals/loader.py b/tests/internals/loader.py index 7663d03e3..006b5787f 100644 --- a/tests/internals/loader.py +++ b/tests/internals/loader.py @@ -31,7 +31,7 @@ def make_loader(basedir): @pytest.mark.datafiles(os.path.join(DATA_DIR, 'onefile')) def test_one_file(datafiles): - basedir = os.path.join(datafiles.dirname, datafiles.basename) + basedir = str(datafiles) loader = make_loader(basedir) element = loader.load(['elements/onefile.bst'])[0] @@ -43,7 +43,7 @@ def test_one_file(datafiles): @pytest.mark.datafiles(os.path.join(DATA_DIR, 'onefile')) def test_missing_file(datafiles): - basedir = os.path.join(datafiles.dirname, datafiles.basename) + basedir = str(datafiles) loader = make_loader(basedir) with pytest.raises(LoadError) as exc: @@ -55,7 +55,7 @@ def test_missing_file(datafiles): @pytest.mark.datafiles(os.path.join(DATA_DIR, 'onefile')) def test_invalid_reference(datafiles): - basedir = os.path.join(datafiles.dirname, datafiles.basename) + basedir = str(datafiles) loader = make_loader(basedir) with pytest.raises(LoadError) as exc: @@ -67,7 +67,7 @@ def test_invalid_reference(datafiles): @pytest.mark.datafiles(os.path.join(DATA_DIR, 'onefile')) def test_invalid_yaml(datafiles): - basedir = os.path.join(datafiles.dirname, datafiles.basename) + basedir = str(datafiles) loader = make_loader(basedir) with pytest.raises(LoadError) as exc: @@ -79,7 +79,7 @@ def test_invalid_yaml(datafiles): @pytest.mark.datafiles(os.path.join(DATA_DIR, 'onefile')) def test_fail_fullpath_target(datafiles): - basedir = os.path.join(datafiles.dirname, datafiles.basename) + basedir = str(datafiles) fullpath = os.path.join(basedir, 'elements', 'onefile.bst') with pytest.raises(LoadError) as exc: @@ -92,7 +92,7 @@ def test_fail_fullpath_target(datafiles): @pytest.mark.datafiles(os.path.join(DATA_DIR, 'onefile')) def test_invalid_key(datafiles): - basedir = os.path.join(datafiles.dirname, datafiles.basename) + basedir = str(datafiles) loader = make_loader(basedir) with pytest.raises(LoadError) as exc: @@ -104,7 +104,7 @@ def test_invalid_key(datafiles): @pytest.mark.datafiles(os.path.join(DATA_DIR, 'onefile')) def test_invalid_directory_load(datafiles): - basedir = os.path.join(datafiles.dirname, datafiles.basename) + basedir = str(datafiles) loader = make_loader(basedir) with pytest.raises(LoadError) as exc: diff --git a/tests/internals/pluginloading.py b/tests/internals/pluginloading.py index 675ac8540..2d997077a 100644 --- a/tests/internals/pluginloading.py +++ b/tests/internals/pluginloading.py @@ -32,7 +32,7 @@ def create_pipeline(tmpdir, basedir, target): @pytest.mark.datafiles(os.path.join(DATA_DIR, 'customsource')) def test_customsource(datafiles, tmpdir): - basedir = os.path.join(datafiles.dirname, datafiles.basename) + basedir = str(datafiles) targets = create_pipeline(tmpdir, basedir, 'simple.bst') assert targets[0].get_kind() == "autotools" @@ -40,14 +40,14 @@ def test_customsource(datafiles, tmpdir): @pytest.mark.datafiles(os.path.join(DATA_DIR, 'customelement')) def test_customelement(datafiles, tmpdir): - basedir = os.path.join(datafiles.dirname, datafiles.basename) + basedir = str(datafiles) targets = create_pipeline(tmpdir, basedir, 'simple.bst') assert targets[0].get_kind() == "foo" @pytest.mark.datafiles(os.path.join(DATA_DIR, 'badversionsource')) def test_badversionsource(datafiles, tmpdir): - basedir = os.path.join(datafiles.dirname, datafiles.basename) + basedir = str(datafiles) with pytest.raises(LoadError) as exc: create_pipeline(tmpdir, basedir, 'simple.bst') @@ -57,7 +57,7 @@ def test_badversionsource(datafiles, tmpdir): @pytest.mark.datafiles(os.path.join(DATA_DIR, 'badversionelement')) def test_badversionelement(datafiles, tmpdir): - basedir = os.path.join(datafiles.dirname, datafiles.basename) + basedir = str(datafiles) with pytest.raises(LoadError) as exc: create_pipeline(tmpdir, basedir, 'simple.bst') diff --git a/tests/plugins/deprecationwarnings/deprecationwarnings.py b/tests/plugins/deprecationwarnings/deprecationwarnings.py index 10b93cc7a..0f61ce271 100644 --- a/tests/plugins/deprecationwarnings/deprecationwarnings.py +++ b/tests/plugins/deprecationwarnings/deprecationwarnings.py @@ -14,7 +14,7 @@ _DEPRECATION_WARNING = "Using deprecated plugin deprecated_plugin: {}".format(_D @pytest.mark.datafiles(DATA_DIR) def test_deprecation_warning_present(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) result = cli.run(project=project, args=['show', 'deprecated.bst']) result.assert_success() assert _DEPRECATION_WARNING in result.stderr @@ -22,7 +22,7 @@ def test_deprecation_warning_present(cli, datafiles): @pytest.mark.datafiles(DATA_DIR) def test_suppress_deprecation_warning(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) cli.run(project=project, args=['show', 'manual.bst']) element_overrides = "elements:\n" \ diff --git a/tests/sandboxes/missing-command.py b/tests/sandboxes/missing-command.py index a2b56d4a7..ee6d11280 100644 --- a/tests/sandboxes/missing-command.py +++ b/tests/sandboxes/missing-command.py @@ -14,6 +14,6 @@ DATA_DIR = os.path.join( @pytest.mark.datafiles(DATA_DIR) def test_missing_command(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) result = cli.run(project=project, args=['build', 'no-runtime.bst']) result.assert_task_error(ErrorDomain.SANDBOX, 'missing-command') diff --git a/tests/sandboxes/missing_dependencies.py b/tests/sandboxes/missing_dependencies.py index 19515a187..850fddaa3 100644 --- a/tests/sandboxes/missing_dependencies.py +++ b/tests/sandboxes/missing_dependencies.py @@ -17,7 +17,7 @@ DATA_DIR = os.path.join( @pytest.mark.skipif(not IS_LINUX, reason='Only available on Linux') @pytest.mark.datafiles(DATA_DIR) def test_missing_brwap_has_nice_error_message(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 @@ -57,7 +57,7 @@ def test_old_brwap_has_nice_error_message(cli, datafiles, tmp_path): bwrap.chmod(0o755) - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) element_path = os.path.join(project, 'elements', 'element3.bst') # Write out our test target diff --git a/tests/sources/bzr.py b/tests/sources/bzr.py index a76814a30..0a3c345bd 100644 --- a/tests/sources/bzr.py +++ b/tests/sources/bzr.py @@ -19,7 +19,7 @@ DATA_DIR = os.path.join( @pytest.mark.skipif(HAVE_BZR is False, reason="bzr is not available") @pytest.mark.datafiles(os.path.join(DATA_DIR)) def test_fetch_checkout(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) checkoutdir = os.path.join(str(tmpdir), 'checkout') repo = create_repo('bzr', str(tmpdir)) diff --git a/tests/sources/deb.py b/tests/sources/deb.py index 6e92facf6..2538efe3b 100644 --- a/tests/sources/deb.py +++ b/tests/sources/deb.py @@ -40,7 +40,7 @@ def _copy_deb(start_location, tmpdir): @pytest.mark.skipif(HAVE_ARPY is False, reason="arpy is not available") @pytest.mark.datafiles(os.path.join(DATA_DIR, 'no-ref')) def test_no_ref(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) generate_project(project, tmpdir) assert cli.get_element_state(project, 'target.bst') == 'no reference' @@ -49,7 +49,7 @@ def test_no_ref(cli, tmpdir, datafiles): @pytest.mark.skipif(HAVE_ARPY is False, reason="arpy is not available") @pytest.mark.datafiles(os.path.join(DATA_DIR, 'fetch')) def test_fetch_bad_url(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) generate_project(project, tmpdir) # Try to fetch it @@ -64,7 +64,7 @@ def test_fetch_bad_url(cli, tmpdir, datafiles): @pytest.mark.skipif(HAVE_ARPY is False, reason="arpy is not available") @pytest.mark.datafiles(os.path.join(DATA_DIR, 'fetch')) def test_fetch_bad_ref(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) generate_project(project, tmpdir) # Copy test deb to tmpdir @@ -82,7 +82,7 @@ def test_fetch_bad_ref(cli, tmpdir, datafiles): @pytest.mark.skipif(HAVE_ARPY is False, reason="arpy is not available") @pytest.mark.datafiles(os.path.join(DATA_DIR, 'fetch')) def test_track_warning(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) generate_project(project, tmpdir) # Copy test deb to tmpdir @@ -100,7 +100,7 @@ def test_track_warning(cli, tmpdir, datafiles): @pytest.mark.skipif(HAVE_ARPY is False, reason="arpy is not available") @pytest.mark.datafiles(os.path.join(DATA_DIR, 'fetch')) def test_stage_default_basedir(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) generate_project(project, tmpdir) checkoutdir = os.path.join(str(tmpdir), "checkout") @@ -128,7 +128,7 @@ def test_stage_default_basedir(cli, tmpdir, datafiles): @pytest.mark.skipif(HAVE_ARPY is False, reason="arpy is not available") @pytest.mark.datafiles(os.path.join(DATA_DIR, 'no-basedir')) def test_stage_no_basedir(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) generate_project(project, tmpdir) checkoutdir = os.path.join(str(tmpdir), "checkout") @@ -156,7 +156,7 @@ def test_stage_no_basedir(cli, tmpdir, datafiles): @pytest.mark.skipif(HAVE_ARPY is False, reason="arpy is not available") @pytest.mark.datafiles(os.path.join(DATA_DIR, 'explicit-basedir')) def test_stage_explicit_basedir(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) generate_project(project, tmpdir) checkoutdir = os.path.join(str(tmpdir), "checkout") diff --git a/tests/sources/generic/build_checkout.py b/tests/sources/generic/build_checkout.py index f2dee6c60..e113b40cb 100644 --- a/tests/sources/generic/build_checkout.py +++ b/tests/sources/generic/build_checkout.py @@ -46,7 +46,7 @@ def strict_args(args, strict): @pytest.mark.parametrize("strict,kind", fetch_build_checkout_combos) def test_fetch_build_checkout(cli, tmpdir, datafiles, strict, kind): checkout = os.path.join(cli.directory, 'checkout') - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) dev_files_path = os.path.join(project, 'files', 'dev-files') element_path = os.path.join(project, 'elements') element_name = 'build-test-{}.bst'.format(kind) diff --git a/tests/sources/generic/fetch.py b/tests/sources/generic/fetch.py index 3c7a28182..f5931f8f1 100644 --- a/tests/sources/generic/fetch.py +++ b/tests/sources/generic/fetch.py @@ -37,7 +37,7 @@ DATA_DIR = os.path.join(TOP_DIR, 'project') @pytest.mark.datafiles(DATA_DIR) @pytest.mark.parametrize("kind", [(kind) for kind in ALL_REPO_KINDS]) def test_fetch(cli, tmpdir, datafiles, kind): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) bin_files_path = os.path.join(project, 'files', 'bin-files') element_path = os.path.join(project, 'elements') element_name = 'fetch-test-{}.bst'.format(kind) diff --git a/tests/sources/generic/track.py b/tests/sources/generic/track.py index 76956fcdb..4726a453e 100644 --- a/tests/sources/generic/track.py +++ b/tests/sources/generic/track.py @@ -52,7 +52,7 @@ def generate_element(repo, element_path, dep_name=None): @pytest.mark.parametrize("ref_storage", [('inline'), ('project.refs')]) @pytest.mark.parametrize("kind", [(kind) for kind in ALL_REPO_KINDS]) def test_track(cli, tmpdir, datafiles, ref_storage, kind): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) dev_files_path = os.path.join(project, 'files', 'dev-files') element_path = os.path.join(project, 'elements') element_name = 'track-test-{}.bst'.format(kind) @@ -112,7 +112,7 @@ def test_track(cli, tmpdir, datafiles, ref_storage, kind): @pytest.mark.parametrize("amount", [(1), (10)]) @pytest.mark.parametrize("kind", [(kind) for kind in ALL_REPO_KINDS]) def test_track_recurse(cli, tmpdir, datafiles, kind, amount): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) dev_files_path = os.path.join(project, 'files', 'dev-files') element_path = os.path.join(project, 'elements') @@ -176,7 +176,7 @@ def test_track_recurse(cli, tmpdir, datafiles, kind, amount): @pytest.mark.datafiles(DATA_DIR) @pytest.mark.parametrize("kind", [(kind) for kind in ALL_REPO_KINDS]) def test_track_recurse_except(cli, tmpdir, datafiles, kind): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) dev_files_path = os.path.join(project, 'files', 'dev-files') element_path = os.path.join(project, 'elements') element_dep_name = 'track-test-dep-{}.bst'.format(kind) @@ -223,7 +223,7 @@ def test_track_recurse_except(cli, tmpdir, datafiles, kind): @pytest.mark.parametrize("ref_storage", [('inline'), ('project.refs')]) @pytest.mark.parametrize("kind", [(kind) for kind in ALL_REPO_KINDS]) def test_cross_junction(cli, tmpdir, datafiles, ref_storage, kind): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) subproject_path = os.path.join(project, 'files', 'sub-project') junction_path = os.path.join(project, 'elements', 'junction.bst') etc_files = os.path.join(subproject_path, 'files', 'etc-files') @@ -266,7 +266,7 @@ def test_cross_junction(cli, tmpdir, datafiles, ref_storage, kind): @pytest.mark.parametrize("ref_storage", [('inline'), ('project.refs')]) @pytest.mark.parametrize("kind", [(kind) for kind in ALL_REPO_KINDS]) def test_track_include(cli, tmpdir, datafiles, ref_storage, kind): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) dev_files_path = os.path.join(project, 'files', 'dev-files') element_path = os.path.join(project, 'elements') element_name = 'track-test-{}.bst'.format(kind) @@ -329,7 +329,7 @@ def test_track_include(cli, tmpdir, datafiles, ref_storage, kind): @pytest.mark.parametrize("ref_storage", [('inline'), ('project.refs')]) @pytest.mark.parametrize("kind", [(kind) for kind in ALL_REPO_KINDS]) def test_track_include_junction(cli, tmpdir, datafiles, ref_storage, kind): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) dev_files_path = os.path.join(project, 'files', 'dev-files') element_path = os.path.join(project, 'elements') element_name = 'track-test-{}.bst'.format(kind) @@ -398,7 +398,7 @@ def test_track_include_junction(cli, tmpdir, datafiles, ref_storage, kind): @pytest.mark.parametrize("ref_storage", [('inline'), ('project.refs')]) @pytest.mark.parametrize("kind", [(kind) for kind in ALL_REPO_KINDS]) def test_track_junction_included(cli, tmpdir, datafiles, ref_storage, kind): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) element_path = os.path.join(project, 'elements') subproject_path = os.path.join(project, 'files', 'sub-project') junction_path = os.path.join(element_path, 'junction.bst') diff --git a/tests/sources/generic/workspace.py b/tests/sources/generic/workspace.py index 552981a4f..ad115c1ba 100644 --- a/tests/sources/generic/workspace.py +++ b/tests/sources/generic/workspace.py @@ -40,9 +40,9 @@ class WorkspaceCreator(): self.datafiles = datafiles if not project_path: - project_path = os.path.join(datafiles.dirname, datafiles.basename) + project_path = str(datafiles) else: - shutil.copytree(os.path.join(datafiles.dirname, datafiles.basename), project_path) + shutil.copytree(str(datafiles), project_path) self.project_path = project_path self.bin_files_path = os.path.join(project_path, 'files', 'bin-files') diff --git a/tests/sources/git.py b/tests/sources/git.py index ca22bb2fd..8922a47d7 100644 --- a/tests/sources/git.py +++ b/tests/sources/git.py @@ -46,7 +46,7 @@ DATA_DIR = os.path.join( @pytest.mark.skipif(HAVE_GIT is False, reason="git is not available") @pytest.mark.datafiles(os.path.join(DATA_DIR, 'template')) def test_fetch_bad_ref(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) # Create the repo from 'repofiles' subdir repo = create_repo('git', str(tmpdir)) @@ -72,7 +72,7 @@ def test_fetch_bad_ref(cli, tmpdir, datafiles): @pytest.mark.skipif(HAVE_GIT is False, reason="git is not available") @pytest.mark.datafiles(os.path.join(DATA_DIR, 'template')) def test_submodule_fetch_checkout(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) checkoutdir = os.path.join(str(tmpdir), "checkout") # Create the submodule first from the 'subrepofiles' subdir @@ -111,7 +111,7 @@ def test_submodule_fetch_checkout(cli, tmpdir, datafiles): @pytest.mark.skipif(HAVE_GIT is False, reason="git is not available") @pytest.mark.datafiles(os.path.join(DATA_DIR, 'template')) def test_submodule_fetch_source_enable_explicit(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) checkoutdir = os.path.join(str(tmpdir), "checkout") # Create the submodule first from the 'subrepofiles' subdir @@ -150,7 +150,7 @@ def test_submodule_fetch_source_enable_explicit(cli, tmpdir, datafiles): @pytest.mark.skipif(HAVE_GIT is False, reason="git is not available") @pytest.mark.datafiles(os.path.join(DATA_DIR, 'template')) def test_submodule_fetch_source_disable(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) checkoutdir = os.path.join(str(tmpdir), "checkout") # Create the submodule first from the 'subrepofiles' subdir @@ -189,7 +189,7 @@ def test_submodule_fetch_source_disable(cli, tmpdir, datafiles): @pytest.mark.skipif(HAVE_GIT is False, reason="git is not available") @pytest.mark.datafiles(os.path.join(DATA_DIR, 'template')) def test_submodule_fetch_submodule_does_override(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) checkoutdir = os.path.join(str(tmpdir), "checkout") # Create the submodule first from the 'subrepofiles' subdir @@ -228,7 +228,7 @@ def test_submodule_fetch_submodule_does_override(cli, tmpdir, datafiles): @pytest.mark.skipif(HAVE_GIT is False, reason="git is not available") @pytest.mark.datafiles(os.path.join(DATA_DIR, 'template')) def test_submodule_fetch_submodule_individual_checkout(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) checkoutdir = os.path.join(str(tmpdir), "checkout") # Create the submodule first from the 'subrepofiles' subdir @@ -273,7 +273,7 @@ def test_submodule_fetch_submodule_individual_checkout(cli, tmpdir, datafiles): @pytest.mark.skipif(HAVE_GIT is False, reason="git is not available") @pytest.mark.datafiles(os.path.join(DATA_DIR, 'template')) def test_submodule_fetch_submodule_individual_checkout_explicit(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) checkoutdir = os.path.join(str(tmpdir), "checkout") # Create the submodule first from the 'subrepofiles' subdir @@ -318,7 +318,7 @@ def test_submodule_fetch_submodule_individual_checkout_explicit(cli, tmpdir, dat @pytest.mark.skipif(HAVE_GIT is False, reason="git is not available") @pytest.mark.datafiles(os.path.join(DATA_DIR, 'project-override')) def test_submodule_fetch_project_override(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) checkoutdir = os.path.join(str(tmpdir), "checkout") # Create the submodule first from the 'subrepofiles' subdir @@ -357,7 +357,7 @@ def test_submodule_fetch_project_override(cli, tmpdir, datafiles): @pytest.mark.skipif(HAVE_GIT is False, reason="git is not available") @pytest.mark.datafiles(os.path.join(DATA_DIR, 'template')) def test_submodule_track_ignore_inconsistent(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) # Create the repo from 'repofiles' subdir repo = create_repo('git', str(tmpdir)) @@ -394,7 +394,7 @@ def test_submodule_track_ignore_inconsistent(cli, tmpdir, datafiles): @pytest.mark.skipif(HAVE_GIT is False, reason="git is not available") @pytest.mark.datafiles(os.path.join(DATA_DIR, 'template')) def test_submodule_track_no_ref_or_track(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) # Create the repo from 'repofiles' subdir repo = create_repo('git', str(tmpdir)) @@ -422,7 +422,7 @@ def test_submodule_track_no_ref_or_track(cli, tmpdir, datafiles): @pytest.mark.datafiles(os.path.join(DATA_DIR, 'template')) @pytest.mark.parametrize("fail", ['warn', 'error']) def test_ref_not_in_track(cli, tmpdir, datafiles, fail): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) # Make the warning an error if we're testing errors if fail == 'error': @@ -465,7 +465,7 @@ def test_ref_not_in_track(cli, tmpdir, datafiles, fail): @pytest.mark.datafiles(os.path.join(DATA_DIR, 'template')) @pytest.mark.parametrize("fail", ['warn', 'error']) def test_unlisted_submodule(cli, tmpdir, datafiles, fail): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) # Make the warning an error if we're testing errors if fail == 'error': @@ -538,7 +538,7 @@ def test_unlisted_submodule(cli, tmpdir, datafiles, fail): @pytest.mark.datafiles(os.path.join(DATA_DIR, 'template')) @pytest.mark.parametrize("fail", ['warn', 'error']) def test_track_unlisted_submodule(cli, tmpdir, datafiles, fail): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) # Make the warning an error if we're testing errors if fail == 'error': @@ -601,7 +601,7 @@ def test_track_unlisted_submodule(cli, tmpdir, datafiles, fail): @pytest.mark.datafiles(os.path.join(DATA_DIR, 'template')) @pytest.mark.parametrize("fail", ['warn', 'error']) def test_invalid_submodule(cli, tmpdir, datafiles, fail): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) # Make the warning an error if we're testing errors if fail == 'error': @@ -673,7 +673,7 @@ def test_invalid_submodule(cli, tmpdir, datafiles, fail): @pytest.mark.datafiles(os.path.join(DATA_DIR, 'template')) @pytest.mark.parametrize("fail", ['warn', 'error']) def test_track_invalid_submodule(cli, tmpdir, datafiles, fail): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) # Make the warning an error if we're testing errors if fail == 'error': @@ -735,7 +735,7 @@ def test_track_invalid_submodule(cli, tmpdir, datafiles, fail): @pytest.mark.parametrize("ref_format", ['sha1', 'git-describe']) @pytest.mark.parametrize("tag,extra_commit", [(False, False), (True, False), (True, True)]) def test_track_fetch(cli, tmpdir, datafiles, ref_format, tag, extra_commit): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) # Create the repo from 'repofiles' subdir repo = create_repo('git', str(tmpdir)) diff --git a/tests/sources/local.py b/tests/sources/local.py index b9201bad7..e5f6d4cdf 100644 --- a/tests/sources/local.py +++ b/tests/sources/local.py @@ -16,7 +16,7 @@ DATA_DIR = os.path.join( @pytest.mark.datafiles(os.path.join(DATA_DIR, 'basic')) def test_missing_path(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) # Removing the local file causes preflight to fail localfile = os.path.join(project, 'file.txt') @@ -30,7 +30,7 @@ def test_missing_path(cli, datafiles): @pytest.mark.datafiles(os.path.join(DATA_DIR, 'basic')) def test_non_regular_file_or_directory(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) localfile = os.path.join(project, 'file.txt') for _file_type in filetypegenerator.generate_file_types(localfile): @@ -48,7 +48,7 @@ def test_non_regular_file_or_directory(cli, datafiles): @pytest.mark.datafiles(os.path.join(DATA_DIR, 'basic')) def test_invalid_absolute_path(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) with open(os.path.join(project, "target.bst"), 'r') as f: old_yaml = f.read() @@ -66,7 +66,7 @@ def test_invalid_absolute_path(cli, datafiles): @pytest.mark.datafiles(os.path.join(DATA_DIR, 'invalid-relative-path')) def test_invalid_relative_path(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) result = cli.run(project=project, args=['show', 'target.bst']) result.assert_main_error(ErrorDomain.LOAD, @@ -75,7 +75,7 @@ def test_invalid_relative_path(cli, datafiles): @pytest.mark.datafiles(os.path.join(DATA_DIR, 'basic')) def test_stage_file(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) checkoutdir = os.path.join(str(tmpdir), "checkout") # Build, checkout @@ -90,7 +90,7 @@ def test_stage_file(cli, tmpdir, datafiles): @pytest.mark.datafiles(os.path.join(DATA_DIR, 'directory')) def test_stage_directory(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) checkoutdir = os.path.join(str(tmpdir), "checkout") # Build, checkout @@ -107,7 +107,7 @@ def test_stage_directory(cli, tmpdir, datafiles): @pytest.mark.datafiles(os.path.join(DATA_DIR, 'symlink')) def test_stage_symlink(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) checkoutdir = os.path.join(str(tmpdir), "checkout") # Workaround datafiles bug: @@ -132,7 +132,7 @@ def test_stage_symlink(cli, tmpdir, datafiles): @pytest.mark.datafiles(os.path.join(DATA_DIR, 'file-exists')) def test_stage_file_exists(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) # Build, checkout result = cli.run(project=project, args=['build', 'target.bst']) @@ -142,7 +142,7 @@ def test_stage_file_exists(cli, datafiles): @pytest.mark.datafiles(os.path.join(DATA_DIR, 'directory')) def test_stage_directory_symlink(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) checkoutdir = os.path.join(str(tmpdir), "checkout") symlink = os.path.join(project, 'files', 'symlink-to-subdir') diff --git a/tests/sources/no_fetch_cached.py b/tests/sources/no_fetch_cached.py index b7952220d..767c193d2 100644 --- a/tests/sources/no_fetch_cached.py +++ b/tests/sources/no_fetch_cached.py @@ -23,7 +23,7 @@ DATA_DIR = os.path.join( @pytest.mark.skipif(HAVE_GIT is False, reason="git is not available") @pytest.mark.datafiles(DATA_DIR) def test_no_fetch_cached(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) # Create the repo from 'files' subdir repo = create_repo('git', str(tmpdir)) diff --git a/tests/sources/ostree.py b/tests/sources/ostree.py index 6b390b5b6..2d4dd953a 100644 --- a/tests/sources/ostree.py +++ b/tests/sources/ostree.py @@ -37,7 +37,7 @@ DATA_DIR = os.path.join( @pytest.mark.datafiles(os.path.join(DATA_DIR, 'template')) def test_submodule_track_no_ref_or_track(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) # Create the repo from 'repofiles' subdir repo = create_repo('ostree', str(tmpdir)) diff --git a/tests/sources/patch.py b/tests/sources/patch.py index 3d53c4b14..49c6594dc 100644 --- a/tests/sources/patch.py +++ b/tests/sources/patch.py @@ -16,7 +16,7 @@ DATA_DIR = os.path.join( @pytest.mark.datafiles(os.path.join(DATA_DIR, 'basic')) def test_missing_patch(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) # Removing the local file causes preflight to fail localfile = os.path.join(project, 'file_1.patch') @@ -30,7 +30,7 @@ def test_missing_patch(cli, datafiles): @pytest.mark.datafiles(os.path.join(DATA_DIR, 'basic')) def test_non_regular_file_patch(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) patch_path = os.path.join(project, 'irregular_file.patch') for _file_type in filetypegenerator.generate_file_types(patch_path): @@ -46,7 +46,7 @@ def test_non_regular_file_patch(cli, datafiles): @pytest.mark.datafiles(os.path.join(DATA_DIR, 'basic')) def test_invalid_absolute_path(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) with open(os.path.join(project, "target.bst"), 'r') as f: old_yaml = f.read() @@ -64,7 +64,7 @@ def test_invalid_absolute_path(cli, datafiles): @pytest.mark.datafiles(os.path.join(DATA_DIR, 'invalid-relative-path')) def test_invalid_relative_path(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) result = cli.run(project=project, args=['show', 'irregular.bst']) result.assert_main_error(ErrorDomain.LOAD, @@ -73,7 +73,7 @@ def test_invalid_relative_path(cli, datafiles): @pytest.mark.datafiles(os.path.join(DATA_DIR, 'basic')) def test_stage_and_patch(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) checkoutdir = os.path.join(str(tmpdir), "checkout") # Build, checkout @@ -89,7 +89,7 @@ def test_stage_and_patch(cli, tmpdir, datafiles): @pytest.mark.datafiles(os.path.join(DATA_DIR, 'basic')) def test_stage_file_nonexistent_dir(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) # Fails at build time because it tries to patch into a non-existing directory result = cli.run(project=project, args=['build', 'failure-nonexistent-dir.bst']) @@ -99,7 +99,7 @@ def test_stage_file_nonexistent_dir(cli, datafiles): @pytest.mark.datafiles(os.path.join(DATA_DIR, 'basic')) def test_stage_file_empty_dir(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) # Fails at build time because it tries to patch with nothing else staged result = cli.run(project=project, args=['build', 'failure-empty-dir.bst']) @@ -109,7 +109,7 @@ def test_stage_file_empty_dir(cli, datafiles): @pytest.mark.datafiles(os.path.join(DATA_DIR, 'separate-patch-dir')) def test_stage_separate_patch_dir(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) checkoutdir = os.path.join(str(tmpdir), "checkout") # Track, fetch, build, checkout @@ -125,7 +125,7 @@ def test_stage_separate_patch_dir(cli, tmpdir, datafiles): @pytest.mark.datafiles(os.path.join(DATA_DIR, 'multiple-patches')) def test_stage_multiple_patches(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) checkoutdir = os.path.join(str(tmpdir), "checkout") # Track, fetch, build, checkout @@ -141,7 +141,7 @@ def test_stage_multiple_patches(cli, tmpdir, datafiles): @pytest.mark.datafiles(os.path.join(DATA_DIR, 'different-strip-level')) def test_patch_strip_level(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) checkoutdir = os.path.join(str(tmpdir), "checkout") # Track, fetch, build, checkout diff --git a/tests/sources/pip.py b/tests/sources/pip.py index 1d1664bf1..0a0a846ef 100644 --- a/tests/sources/pip.py +++ b/tests/sources/pip.py @@ -23,7 +23,7 @@ def generate_project(project_dir): # Test that without ref, consistency is set appropriately. @pytest.mark.datafiles(os.path.join(DATA_DIR, 'no-ref')) def test_no_ref(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) generate_project(project) assert cli.get_element_state(project, 'target.bst') == 'no reference' @@ -31,7 +31,7 @@ def test_no_ref(cli, datafiles): # Test that pip is not allowed to be the first source @pytest.mark.datafiles(os.path.join(DATA_DIR, 'first-source-pip')) def test_first_source(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) generate_project(project) result = cli.run(project=project, args=[ 'show', 'target.bst' @@ -43,7 +43,7 @@ def test_first_source(cli, datafiles): # have been specified @pytest.mark.datafiles(os.path.join(DATA_DIR, 'no-packages')) def test_no_packages(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) generate_project(project) result = cli.run(project=project, args=[ 'show', 'target.bst' diff --git a/tests/sources/previous_source_access.py b/tests/sources/previous_source_access.py index cb1c54c27..29d1f3023 100644 --- a/tests/sources/previous_source_access.py +++ b/tests/sources/previous_source_access.py @@ -18,7 +18,7 @@ DATA_DIR = os.path.join( # Test that plugins can access data from previous sources @pytest.mark.datafiles(DATA_DIR) def test_custom_transform_source(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) # Ensure we can track result = cli.run(project=project, args=[ diff --git a/tests/sources/remote.py b/tests/sources/remote.py index f6ea9bf65..2a23895ac 100644 --- a/tests/sources/remote.py +++ b/tests/sources/remote.py @@ -39,7 +39,7 @@ def generate_project_file_server(server, project_dir): # Test that without ref, consistency is set appropriately. @pytest.mark.datafiles(os.path.join(DATA_DIR, 'no-ref')) def test_no_ref(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) generate_project(project, tmpdir) assert cli.get_element_state(project, 'target.bst') == 'no reference' @@ -48,7 +48,7 @@ def test_no_ref(cli, tmpdir, datafiles): # refers to 'file' but that file is not present. @pytest.mark.datafiles(os.path.join(DATA_DIR, 'missing-file')) def test_missing_file(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) generate_project(project, tmpdir) # Try to fetch it @@ -62,7 +62,7 @@ def test_missing_file(cli, tmpdir, datafiles): @pytest.mark.datafiles(os.path.join(DATA_DIR, 'path-in-filename')) def test_path_in_filename(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) generate_project(project, tmpdir) # Try to fetch it @@ -76,7 +76,7 @@ def test_path_in_filename(cli, tmpdir, datafiles): @pytest.mark.datafiles(os.path.join(DATA_DIR, 'single-file')) def test_simple_file_build(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) generate_project(project, tmpdir) checkoutdir = os.path.join(str(tmpdir), "checkout") @@ -109,7 +109,7 @@ def test_simple_file_build(cli, tmpdir, datafiles): @pytest.mark.datafiles(os.path.join(DATA_DIR, 'single-file-custom-name')) def test_simple_file_custom_name_build(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) generate_project(project, tmpdir) checkoutdir = os.path.join(str(tmpdir), "checkout") @@ -137,7 +137,7 @@ def test_unique_key(cli, tmpdir, datafiles): '''This test confirms that the 'filename' parameter is honoured when it comes to generating a cache key for the source. ''' - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) generate_project(project, tmpdir) states = cli.get_element_states(project, [ 'target.bst', 'target-custom.bst', 'target-custom-executable.bst' @@ -169,7 +169,7 @@ def test_unique_key(cli, tmpdir, datafiles): def test_executable(cli, tmpdir, datafiles): '''This test confirms that the 'ecxecutable' parameter is honoured. ''' - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) generate_project(project, tmpdir) checkoutdir = os.path.join(str(tmpdir), "checkout") assert cli.get_element_state(project, 'target-custom-executable.bst') == "fetch needed" diff --git a/tests/sources/tar.py b/tests/sources/tar.py index ca6806b32..7a516459d 100644 --- a/tests/sources/tar.py +++ b/tests/sources/tar.py @@ -68,7 +68,7 @@ def generate_project_file_server(base_url, project_dir): # Test that without ref, consistency is set appropriately. @pytest.mark.datafiles(os.path.join(DATA_DIR, 'no-ref')) def test_no_ref(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) generate_project(project, tmpdir) assert cli.get_element_state(project, 'target.bst') == 'no reference' @@ -76,7 +76,7 @@ def test_no_ref(cli, tmpdir, datafiles): # Test that when I fetch a nonexistent URL, errors are handled gracefully and a retry is performed. @pytest.mark.datafiles(os.path.join(DATA_DIR, 'fetch')) def test_fetch_bad_url(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) generate_project(project, tmpdir) # Try to fetch it @@ -91,7 +91,7 @@ def test_fetch_bad_url(cli, tmpdir, datafiles): # Test that when I fetch with an invalid ref, it fails. @pytest.mark.datafiles(os.path.join(DATA_DIR, 'fetch')) def test_fetch_bad_ref(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) generate_project(project, tmpdir) # Create a local tar @@ -109,7 +109,7 @@ def test_fetch_bad_ref(cli, tmpdir, datafiles): # Test that when tracking with a ref set, there is a warning @pytest.mark.datafiles(os.path.join(DATA_DIR, 'fetch')) def test_track_warning(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) generate_project(project, tmpdir) # Create a local tar @@ -128,7 +128,7 @@ def test_track_warning(cli, tmpdir, datafiles): @pytest.mark.datafiles(os.path.join(DATA_DIR, 'fetch')) @pytest.mark.parametrize("srcdir", ["a", "./a"]) def test_stage_default_basedir(cli, tmpdir, datafiles, srcdir): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) generate_project(project, tmpdir) checkoutdir = os.path.join(str(tmpdir), "checkout") @@ -157,7 +157,7 @@ def test_stage_default_basedir(cli, tmpdir, datafiles, srcdir): @pytest.mark.datafiles(os.path.join(DATA_DIR, 'no-basedir')) @pytest.mark.parametrize("srcdir", ["a", "./a"]) def test_stage_no_basedir(cli, tmpdir, datafiles, srcdir): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) generate_project(project, tmpdir) checkoutdir = os.path.join(str(tmpdir), "checkout") @@ -186,7 +186,7 @@ def test_stage_no_basedir(cli, tmpdir, datafiles, srcdir): @pytest.mark.datafiles(os.path.join(DATA_DIR, 'explicit-basedir')) @pytest.mark.parametrize("srcdir", ["a", "./a"]) def test_stage_explicit_basedir(cli, tmpdir, datafiles, srcdir): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) generate_project(project, tmpdir) checkoutdir = os.path.join(str(tmpdir), "checkout") @@ -215,7 +215,7 @@ def test_stage_explicit_basedir(cli, tmpdir, datafiles, srcdir): # leading paths @pytest.mark.datafiles(os.path.join(DATA_DIR, 'contains-links')) def test_stage_contains_links(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) generate_project(project, tmpdir) checkoutdir = os.path.join(str(tmpdir), "checkout") @@ -251,7 +251,7 @@ def test_stage_contains_links(cli, tmpdir, datafiles): @pytest.mark.datafiles(os.path.join(DATA_DIR, 'fetch')) @pytest.mark.parametrize("srcdir", ["a", "./a"]) def test_stage_default_basedir_lzip(cli, tmpdir, datafiles, srcdir): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) generate_project(project, tmpdir) checkoutdir = os.path.join(str(tmpdir), "checkout") @@ -280,7 +280,7 @@ def test_stage_default_basedir_lzip(cli, tmpdir, datafiles, srcdir): @pytest.mark.datafiles(os.path.join(DATA_DIR, 'read-only')) def test_read_only_dir(cli, tmpdir, datafiles): try: - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) generate_project(project, tmpdir) # Get the tarball in tests/sources/tar/read-only/content @@ -397,7 +397,7 @@ def test_netrc_already_specified_user(cli, datafiles, server_type, tmpdir): # the netrc module is trying to find it's ~/.netrc file. @pytest.mark.datafiles(os.path.join(DATA_DIR, 'fetch')) def test_homeless_environment(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) generate_project(project, tmpdir) # Create a local tar diff --git a/tests/sources/zip.py b/tests/sources/zip.py index 3193d38ca..1c86e56d7 100644 --- a/tests/sources/zip.py +++ b/tests/sources/zip.py @@ -53,7 +53,7 @@ def generate_project_file_server(server, project_dir): # Test that without ref, consistency is set appropriately. @pytest.mark.datafiles(os.path.join(DATA_DIR, 'no-ref')) def test_no_ref(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) generate_project(project, tmpdir) assert cli.get_element_state(project, 'target.bst') == 'no reference' @@ -61,7 +61,7 @@ def test_no_ref(cli, tmpdir, datafiles): # Test that when I fetch a nonexistent URL, errors are handled gracefully and a retry is performed. @pytest.mark.datafiles(os.path.join(DATA_DIR, 'fetch')) def test_fetch_bad_url(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) generate_project(project, tmpdir) # Try to fetch it @@ -76,7 +76,7 @@ def test_fetch_bad_url(cli, tmpdir, datafiles): # Test that when I fetch with an invalid ref, it fails. @pytest.mark.datafiles(os.path.join(DATA_DIR, 'fetch')) def test_fetch_bad_ref(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) generate_project(project, tmpdir) # Create a local tar @@ -94,7 +94,7 @@ def test_fetch_bad_ref(cli, tmpdir, datafiles): # Test that when tracking with a ref set, there is a warning @pytest.mark.datafiles(os.path.join(DATA_DIR, 'fetch')) def test_track_warning(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) generate_project(project, tmpdir) # Create a local tar @@ -112,7 +112,7 @@ def test_track_warning(cli, tmpdir, datafiles): # Test that a staged checkout matches what was tarred up, with the default first subdir @pytest.mark.datafiles(os.path.join(DATA_DIR, 'fetch')) def test_stage_default_basedir(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) generate_project(project, tmpdir) checkoutdir = os.path.join(str(tmpdir), "checkout") @@ -140,7 +140,7 @@ def test_stage_default_basedir(cli, tmpdir, datafiles): # Test that a staged checkout matches what was tarred up, with an empty base-dir @pytest.mark.datafiles(os.path.join(DATA_DIR, 'no-basedir')) def test_stage_no_basedir(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) generate_project(project, tmpdir) checkoutdir = os.path.join(str(tmpdir), "checkout") @@ -168,7 +168,7 @@ def test_stage_no_basedir(cli, tmpdir, datafiles): # Test that a staged checkout matches what was tarred up, with an explicit basedir @pytest.mark.datafiles(os.path.join(DATA_DIR, 'explicit-basedir')) def test_stage_explicit_basedir(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) generate_project(project, tmpdir) checkoutdir = os.path.join(str(tmpdir), "checkout") |