diff options
author | bst-marge-bot <marge-bot@buildstream.build> | 2019-03-01 19:49:54 +0000 |
---|---|---|
committer | bst-marge-bot <marge-bot@buildstream.build> | 2019-03-01 19:49:54 +0000 |
commit | 52e6d2e3cb4a01fc8b7ae4d46d1f42f76059466d (patch) | |
tree | bb3133310939227a78de0dab3da15520b8ef5d8e | |
parent | 8f9b3dcdaca6f5179b79328b17b3e2c71db19e73 (diff) | |
parent | 29f8df922fabd350b535f3949cf138b193b409f3 (diff) | |
download | buildstream-52e6d2e3cb4a01fc8b7ae4d46d1f42f76059466d.tar.gz |
Merge branch 'remove-dead-code' into 'master'
Remove dead code
See merge request BuildStream/buildstream!1195
85 files changed, 265 insertions, 361 deletions
diff --git a/tests/artifactcache/cache_size.py b/tests/artifactcache/cache_size.py index dcfc13424..104c43ce0 100644 --- a/tests/artifactcache/cache_size.py +++ b/tests/artifactcache/cache_size.py @@ -1,5 +1,4 @@ import os -import pytest from unittest import mock from buildstream import _yaml @@ -60,9 +59,6 @@ def test_cache_size_write(cli, tmpdir): # Inspect the artifact cache sizefile = os.path.join(casdir, CACHE_SIZE_FILE) assert os.path.isfile(sizefile) - with open(sizefile, "r") as f: - size_data = f.read() - size = int(size_data) def test_quota_over_1024T(cli, tmpdir): diff --git a/tests/artifactcache/expiry.py b/tests/artifactcache/expiry.py index e959634cb..20e8cbda2 100644 --- a/tests/artifactcache/expiry.py +++ b/tests/artifactcache/expiry.py @@ -23,7 +23,6 @@ from unittest import mock import pytest -from buildstream import _yaml from buildstream._exceptions import ErrorDomain, LoadErrorReason from buildstream.plugintestutils import cli @@ -39,11 +38,9 @@ DATA_DIR = os.path.join( # Ensure that the cache successfully removes an old artifact if we do # not have enough space left. @pytest.mark.datafiles(DATA_DIR) -def test_artifact_expires(cli, datafiles, tmpdir): +def test_artifact_expires(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) element_path = 'elements' - cache_location = os.path.join(project, 'cache', 'artifacts', 'ostree') - checkout = os.path.join(project, 'checkout') cli.configure({ 'cache': { @@ -83,7 +80,7 @@ def test_artifact_expires(cli, datafiles, tmpdir): (399999) ]) @pytest.mark.datafiles(DATA_DIR) -def test_artifact_too_large(cli, datafiles, tmpdir, size): +def test_artifact_too_large(cli, datafiles, size): project = os.path.join(datafiles.dirname, datafiles.basename) element_path = 'elements' @@ -101,10 +98,9 @@ def test_artifact_too_large(cli, datafiles, tmpdir, size): @pytest.mark.datafiles(DATA_DIR) -def test_expiry_order(cli, datafiles, tmpdir): +def test_expiry_order(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) element_path = 'elements' - cache_location = os.path.join(project, 'cache', 'artifacts', 'ostree') checkout = os.path.join(project, 'workspace') cli.configure({ @@ -159,10 +155,9 @@ def test_expiry_order(cli, datafiles, tmpdir): # in the current build pipeline, because that would be embarassing, # wouldn't it? @pytest.mark.datafiles(DATA_DIR) -def test_keep_dependencies(cli, datafiles, tmpdir): +def test_keep_dependencies(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) element_path = 'elements' - cache_location = os.path.join(project, 'cache', 'artifacts', 'ostree') cli.configure({ 'cache': { @@ -206,7 +201,7 @@ def test_keep_dependencies(cli, datafiles, tmpdir): # Assert that we never delete a dependency required for a build tree @pytest.mark.datafiles(DATA_DIR) -def test_never_delete_required(cli, datafiles, tmpdir): +def test_never_delete_required(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) element_path = 'elements' @@ -258,7 +253,7 @@ def test_never_delete_required(cli, datafiles, tmpdir): # artifacts we do not require, and the new build is run with dynamic tracking. # @pytest.mark.datafiles(DATA_DIR) -def test_never_delete_required_track(cli, datafiles, tmpdir): +def test_never_delete_required_track(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) element_path = 'elements' @@ -348,7 +343,7 @@ def test_never_delete_required_track(cli, datafiles, tmpdir): ("70%", 'warning', 'Your system does not have enough available') ]) @pytest.mark.datafiles(DATA_DIR) -def test_invalid_cache_quota(cli, datafiles, tmpdir, quota, err_domain, err_reason): +def test_invalid_cache_quota(cli, datafiles, quota, err_domain, err_reason): project = os.path.join(datafiles.dirname, datafiles.basename) os.makedirs(os.path.join(project, 'elements')) @@ -399,11 +394,9 @@ def test_invalid_cache_quota(cli, datafiles, tmpdir, quota, err_domain, err_reas # the cache size and cleanup jobs are run before any other jobs. # @pytest.mark.datafiles(DATA_DIR) -def test_cleanup_first(cli, datafiles, tmpdir): +def test_cleanup_first(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) element_path = 'elements' - cache_location = os.path.join(project, 'cache', 'artifacts', 'ostree') - checkout = os.path.join(project, 'checkout') cli.configure({ 'cache': { diff --git a/tests/artifactcache/pull.py b/tests/artifactcache/pull.py index 3113061ca..3e05bcecf 100644 --- a/tests/artifactcache/pull.py +++ b/tests/artifactcache/pull.py @@ -1,4 +1,3 @@ -import hashlib import multiprocessing import os import signal diff --git a/tests/artifactcache/push.py b/tests/artifactcache/push.py index a7b8bdbd9..18d6d80bc 100644 --- a/tests/artifactcache/push.py +++ b/tests/artifactcache/push.py @@ -4,7 +4,6 @@ import signal import pytest -from pluginbase import PluginBase from buildstream import _yaml, _signals, utils from buildstream._context import Context from buildstream._project import Project @@ -245,13 +244,12 @@ def _test_push_directory(user_config_file, project_dir, artifact_digest, queue): @pytest.mark.datafiles(DATA_DIR) -def test_push_message(cli, tmpdir, datafiles): +def test_push_message(tmpdir, datafiles): project_dir = str(datafiles) # Set up an artifact cache. with create_artifact_share(os.path.join(str(tmpdir), 'artifactshare')) as share: # Configure artifact share - artifact_dir = os.path.join(str(tmpdir), 'cache', 'artifacts') rootcache_dir = os.path.join(str(tmpdir), 'cache') user_config_file = str(tmpdir.join('buildstream.conf')) user_config = { diff --git a/tests/cachekey/cachekey.py b/tests/cachekey/cachekey.py index 4a6896888..456e403d4 100644 --- a/tests/cachekey/cachekey.py +++ b/tests/cachekey/cachekey.py @@ -92,7 +92,7 @@ def load_expected_keys(project_dir, actual_keys, raise_error=True): with open(expected, 'r') as f: expected_key = f.read() expected_key = expected_key.strip() - except FileNotFoundError as e: + except FileNotFoundError: expected_key = None if raise_error: raise Exception("Cache key test needs update, " + diff --git a/tests/elements/filter.py b/tests/elements/filter.py index c0ef2568a..a166b820c 100644 --- a/tests/elements/filter.py +++ b/tests/elements/filter.py @@ -1,7 +1,7 @@ import os import pytest import shutil -from tests.testutils import create_repo, ALL_REPO_KINDS +from tests.testutils import create_repo from buildstream.plugintestutils import cli from buildstream._exceptions import ErrorDomain from buildstream import _yaml @@ -118,7 +118,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, tmpdir): +def test_filter_workspace_open_multi(datafiles, cli): project = os.path.join(datafiles.dirname, datafiles.basename) result = cli.run(cwd=project, project=project, args=['workspace', 'open', 'deps-permitted.bst', 'output-orphans.bst']) @@ -240,7 +240,7 @@ def test_filter_track(datafiles, cli, tmpdir): @pytest.mark.datafiles(os.path.join(DATA_DIR, 'basic')) def test_filter_track_excepted(datafiles, cli, tmpdir): repo = create_repo('git', str(tmpdir)) - ref = repo.create(os.path.join(str(datafiles), "files")) + repo.create(os.path.join(str(datafiles), "files")) elements_dir = os.path.join(str(tmpdir), "elements") project = str(tmpdir) input_name = "input.bst" @@ -488,7 +488,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, tmpdir): +def test_filter_fails_for_nonexisting_domain(datafiles, cli): project = os.path.join(datafiles.dirname, datafiles.basename) 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 96827ff4c..d653cdcd2 100644 --- a/tests/examples/autotools.py +++ b/tests/examples/autotools.py @@ -17,7 +17,7 @@ DATA_DIR = os.path.join( reason='Examples are writtent for x86-64') @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, tmpdir, datafiles): +def test_autotools_build(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) checkout = os.path.join(cli.directory, 'checkout') @@ -40,7 +40,7 @@ def test_autotools_build(cli, tmpdir, datafiles): reason='Examples are writtent for x86-64') @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, tmpdir, datafiles): +def test_autotools_run(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) result = cli.run(project=project, args=['build', 'hello.bst']) diff --git a/tests/examples/developing.py b/tests/examples/developing.py index 3ef78fd36..a5e3c2d9a 100644 --- a/tests/examples/developing.py +++ b/tests/examples/developing.py @@ -18,7 +18,7 @@ DATA_DIR = os.path.join( reason='Examples are writtent for x86-64') @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, tmpdir, datafiles): +def test_autotools_build(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) checkout = os.path.join(cli.directory, 'checkout') @@ -39,7 +39,7 @@ def test_autotools_build(cli, tmpdir, datafiles): reason='Examples are writtent for x86-64') @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, tmpdir, datafiles): +def test_run_unmodified_hello(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) result = cli.run(project=project, args=['build', 'hello.bst']) diff --git a/tests/examples/first-project.py b/tests/examples/first-project.py index 35839770c..efbea4d0c 100644 --- a/tests/examples/first-project.py +++ b/tests/examples/first-project.py @@ -16,7 +16,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, tmpdir, datafiles): +def test_first_project_build_checkout(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) checkout = os.path.join(cli.directory, 'checkout') diff --git a/tests/examples/flatpak-autotools.py b/tests/examples/flatpak-autotools.py index 454b8d0bb..44b0ef93d 100644 --- a/tests/examples/flatpak-autotools.py +++ b/tests/examples/flatpak-autotools.py @@ -36,7 +36,7 @@ def workaround_setuptools_bug(project): reason='Examples are writtent for x86-64') @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, tmpdir, datafiles): +def test_autotools_build(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) checkout = os.path.join(cli.directory, 'checkout') workaround_setuptools_bug(project) @@ -59,7 +59,7 @@ def test_autotools_build(cli, tmpdir, datafiles): reason='Examples are writtent for x86-64') @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, tmpdir, datafiles): +def test_autotools_run(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) workaround_setuptools_bug(project) diff --git a/tests/examples/integration-commands.py b/tests/examples/integration-commands.py index abc64d951..bbcaafbfd 100644 --- a/tests/examples/integration-commands.py +++ b/tests/examples/integration-commands.py @@ -2,7 +2,6 @@ import os import pytest from buildstream.plugintestutils import cli_integration as cli -from buildstream.plugintestutils.integration import assert_contains from tests.testutils.site import HAVE_BWRAP, IS_LINUX, MACHINE_ARCH @@ -16,9 +15,8 @@ DATA_DIR = os.path.join( reason='Examples are writtent for x86-64') @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, tmpdir, datafiles): +def test_integration_commands_build(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) - checkout = os.path.join(cli.directory, 'checkout') result = cli.run(project=project, args=['build', 'hello.bst']) assert result.exit_code == 0 @@ -29,7 +27,7 @@ def test_integration_commands_build(cli, tmpdir, datafiles): reason='Examples are writtent for x86-64') @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, tmpdir, datafiles): +def test_integration_commands_run(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) result = cli.run(project=project, args=['build', 'hello.bst']) diff --git a/tests/examples/junctions.py b/tests/examples/junctions.py index 3992b1520..777bf71a0 100644 --- a/tests/examples/junctions.py +++ b/tests/examples/junctions.py @@ -2,7 +2,6 @@ import os import pytest from buildstream.plugintestutils import cli_integration as cli -from buildstream.plugintestutils.integration import assert_contains from tests.testutils.site import IS_LINUX, HAVE_BWRAP, MACHINE_ARCH pytestmark = pytest.mark.integration @@ -17,7 +16,7 @@ DATA_DIR = os.path.join( reason='Examples are writtent for x86-64') @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, tmpdir, datafiles): +def test_build(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) result = cli.run(project=project, args=['build', 'callHello.bst']) @@ -29,7 +28,7 @@ def test_build(cli, tmpdir, datafiles): reason='Examples are writtent for x86-64') @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, tmpdir, datafiles): +def test_shell_call_hello(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) result = cli.run(project=project, args=['build', 'callHello.bst']) diff --git a/tests/examples/running-commands.py b/tests/examples/running-commands.py index 6290204a9..677b14654 100644 --- a/tests/examples/running-commands.py +++ b/tests/examples/running-commands.py @@ -2,7 +2,6 @@ import os import pytest from buildstream.plugintestutils import cli_integration as cli -from buildstream.plugintestutils.integration import assert_contains from tests.testutils.site import IS_LINUX, HAVE_BWRAP, MACHINE_ARCH @@ -16,9 +15,8 @@ DATA_DIR = os.path.join( reason='Examples are writtent for x86-64') @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, tmpdir, datafiles): +def test_running_commands_build(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) - checkout = os.path.join(cli.directory, 'checkout') result = cli.run(project=project, args=['build', 'hello.bst']) assert result.exit_code == 0 @@ -29,7 +27,7 @@ def test_running_commands_build(cli, tmpdir, datafiles): reason='Examples are writtent for x86-64') @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, tmpdir, datafiles): +def test_running_commands_run(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) result = cli.run(project=project, args=['build', 'hello.bst']) diff --git a/tests/format/junctions.py b/tests/format/junctions.py index 7f27b5982..0c94bb51a 100644 --- a/tests/format/junctions.py +++ b/tests/format/junctions.py @@ -2,7 +2,7 @@ import os import pytest import shutil -from buildstream import _yaml, ElementError +from buildstream import _yaml from buildstream._exceptions import ErrorDomain, LoadErrorReason from buildstream.plugintestutils import cli from tests.testutils import create_repo @@ -49,7 +49,7 @@ def test_simple_build(cli, tmpdir, datafiles): @pytest.mark.datafiles(DATA_DIR) -def test_build_of_same_junction_used_twice(cli, tmpdir, datafiles): +def test_build_of_same_junction_used_twice(cli, datafiles): project = os.path.join(str(datafiles), 'inconsistent-names') # Check we can build a project that contains the same junction @@ -213,7 +213,6 @@ def test_options_inherit(cli, tmpdir, datafiles): @pytest.mark.datafiles(DATA_DIR) def test_git_show(cli, tmpdir, datafiles): project = os.path.join(str(datafiles), 'foo') - checkoutdir = os.path.join(str(tmpdir), "checkout") # Create the repo from 'base' subdir repo = create_repo('git', str(tmpdir)) @@ -272,7 +271,7 @@ def test_git_build(cli, tmpdir, datafiles): @pytest.mark.datafiles(DATA_DIR) -def test_cross_junction_names(cli, tmpdir, datafiles): +def test_cross_junction_names(cli, datafiles): project = os.path.join(str(datafiles), 'foo') copy_subprojects(project, datafiles, ['base']) diff --git a/tests/format/project.py b/tests/format/project.py index db6604409..c746409bb 100644 --- a/tests/format/project.py +++ b/tests/format/project.py @@ -111,7 +111,7 @@ def test_missing_element_path_directory(cli, datafiles): def test_element_path_not_a_directory(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) path = os.path.join(project, 'elements') - for file_type in filetypegenerator.generate_file_types(path): + for _file_type in filetypegenerator.generate_file_types(path): result = cli.run(project=project, args=['workspace', 'list']) if not os.path.isdir(path): result.assert_main_error(ErrorDomain.LOAD, @@ -132,7 +132,7 @@ def test_missing_local_plugin_directory(cli, datafiles): def test_local_plugin_not_directory(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) path = os.path.join(project, 'plugins') - for file_type in filetypegenerator.generate_file_types(path): + for _file_type in filetypegenerator.generate_file_types(path): result = cli.run(project=project, args=['workspace', 'list']) if not os.path.isdir(path): result.assert_main_error(ErrorDomain.LOAD, @@ -190,7 +190,7 @@ def test_plugin_no_load_ref(cli, datafiles, ref_storage): @pytest.mark.datafiles(DATA_DIR) -def test_plugin_preflight_error(cli, datafiles, tmpdir): +def test_plugin_preflight_error(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename, 'plugin-preflight-error') result = cli.run(project=project, args=['source', 'fetch', 'error.bst']) result.assert_main_error(ErrorDomain.SOURCE, "the-preflight-error") diff --git a/tests/format/variables.py b/tests/format/variables.py index 5a0d21206..3fa0f4790 100644 --- a/tests/format/variables.py +++ b/tests/format/variables.py @@ -37,7 +37,7 @@ def print_warning(msg): ('qmake.bst', 'make-install', "make -j1 INSTALL_ROOT=\"/buildstream-install\" install"), ]) @pytest.mark.datafiles(os.path.join(DATA_DIR, 'defaults')) -def test_defaults(cli, datafiles, tmpdir, target, varname, expected): +def test_defaults(cli, datafiles, target, varname, expected): project = os.path.join(datafiles.dirname, datafiles.basename) result = cli.run(project=project, silent=True, args=[ 'show', '--deps', 'none', '--format', '%{vars}', target @@ -63,7 +63,7 @@ def test_defaults(cli, datafiles, tmpdir, target, varname, expected): ('qmake.bst', 'make-install', "make -j1 INSTALL_ROOT=\"/custom/install/root\" install"), ]) @pytest.mark.datafiles(os.path.join(DATA_DIR, 'overrides')) -def test_overrides(cli, datafiles, tmpdir, target, varname, expected): +def test_overrides(cli, datafiles, target, varname, expected): project = os.path.join(datafiles.dirname, datafiles.basename) result = cli.run(project=project, silent=True, args=[ 'show', '--deps', 'none', '--format', '%{vars}', target @@ -74,7 +74,7 @@ def test_overrides(cli, datafiles, tmpdir, target, varname, expected): @pytest.mark.datafiles(os.path.join(DATA_DIR, 'missing_variables')) -def test_missing_variable(cli, datafiles, tmpdir): +def test_missing_variable(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) result = cli.run(project=project, silent=True, args=[ 'show', '--deps', 'none', '--format', '%{config}', 'manual.bst' @@ -97,7 +97,7 @@ def test_cyclic_variables(cli, datafiles): @pytest.mark.parametrize('protected_var', PROTECTED_VARIABLES) @pytest.mark.datafiles(os.path.join(DATA_DIR, 'protected-vars')) -def test_use_of_protected_var_project_conf(cli, tmpdir, datafiles, protected_var): +def test_use_of_protected_var_project_conf(cli, datafiles, protected_var): project = str(datafiles) conf = { 'name': 'test', @@ -125,7 +125,7 @@ def test_use_of_protected_var_project_conf(cli, tmpdir, datafiles, protected_var @pytest.mark.parametrize('protected_var', PROTECTED_VARIABLES) @pytest.mark.datafiles(os.path.join(DATA_DIR, 'protected-vars')) -def test_use_of_protected_var_element_overrides(cli, tmpdir, datafiles, protected_var): +def test_use_of_protected_var_element_overrides(cli, datafiles, protected_var): project = str(datafiles) conf = { 'name': 'test', @@ -157,7 +157,7 @@ def test_use_of_protected_var_element_overrides(cli, tmpdir, datafiles, protecte @pytest.mark.parametrize('protected_var', PROTECTED_VARIABLES) @pytest.mark.datafiles(os.path.join(DATA_DIR, 'protected-vars')) -def test_use_of_protected_var_in_element(cli, tmpdir, datafiles, protected_var): +def test_use_of_protected_var_in_element(cli, datafiles, protected_var): project = str(datafiles) element = { 'kind': 'import', diff --git a/tests/frontend/artifact.py b/tests/frontend/artifact.py index 896d39a38..c8301c529 100644 --- a/tests/frontend/artifact.py +++ b/tests/frontend/artifact.py @@ -32,7 +32,7 @@ DATA_DIR = os.path.join( @pytest.mark.datafiles(DATA_DIR) -def test_artifact_log(cli, tmpdir, datafiles): +def test_artifact_log(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) # Get the cache key of our test element diff --git a/tests/frontend/buildcheckout.py b/tests/frontend/buildcheckout.py index af34e6d67..808f7e128 100644 --- a/tests/frontend/buildcheckout.py +++ b/tests/frontend/buildcheckout.py @@ -98,7 +98,6 @@ def test_build_default(cli, datafiles): ]) def test_build_invalid_suffix(datafiles, cli, strict, hardlinks): project = os.path.join(datafiles.dirname, datafiles.basename) - checkout = os.path.join(cli.directory, 'checkout') result = cli.run(project=project, args=strict_args(['build', 'target.foo'], strict)) result.assert_main_error(ErrorDomain.LOAD, "bad-element-suffix") @@ -110,7 +109,6 @@ def test_build_invalid_suffix(datafiles, cli, strict, hardlinks): ]) def test_build_invalid_suffix_dep(datafiles, cli, strict, hardlinks): project = os.path.join(datafiles.dirname, datafiles.basename) - checkout = os.path.join(cli.directory, 'checkout') # target2.bst depends on an element called target.foo result = cli.run(project=project, args=strict_args(['build', 'target2.bst'], strict)) @@ -455,7 +453,7 @@ def test_fetch_build_checkout(cli, tmpdir, datafiles, strict, kind): @pytest.mark.datafiles(DATA_DIR) -def test_install_to_build(cli, tmpdir, datafiles): +def test_install_to_build(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) element = 'installed-to-build.bst' @@ -564,7 +562,7 @@ def test_build_checkout_junction(cli, tmpdir, datafiles): checkout = os.path.join(cli.directory, 'checkout') # Create a repo to hold the subproject and generate a junction element for it - ref = generate_junction(tmpdir, subproject_path, junction_path) + generate_junction(tmpdir, subproject_path, junction_path) # Create a stack element to depend on a cross junction element # @@ -611,7 +609,7 @@ def test_build_checkout_junction_default_targets(cli, tmpdir, datafiles): checkout = os.path.join(cli.directory, 'checkout') # Create a repo to hold the subproject and generate a junction element for it - ref = generate_junction(tmpdir, subproject_path, junction_path) + generate_junction(tmpdir, subproject_path, junction_path) # Create a stack element to depend on a cross junction element # @@ -658,7 +656,7 @@ def test_build_checkout_workspaced_junction(cli, tmpdir, datafiles): checkout = os.path.join(cli.directory, 'checkout') # Create a repo to hold the subproject and generate a junction element for it - ref = generate_junction(tmpdir, subproject_path, junction_path) + generate_junction(tmpdir, subproject_path, junction_path) # Create a stack element to depend on a cross junction element # @@ -737,11 +735,10 @@ def test_build_junction_short_notation(cli, tmpdir, 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') - workspace = os.path.join(cli.directory, 'workspace') checkout = os.path.join(cli.directory, 'checkout') # Create a repo to hold the subproject and generate a junction element for it - ref = generate_junction(tmpdir, subproject_path, junction_path) + generate_junction(tmpdir, subproject_path, junction_path) # Create a stack element to depend on a cross junction element, using # colon (:) as the separator @@ -782,7 +779,7 @@ def test_build_junction_short_notation_filename(cli, tmpdir, datafiles): checkout = os.path.join(cli.directory, 'checkout') # Create a repo to hold the subproject and generate a junction element for it - ref = generate_junction(tmpdir, subproject_path, junction_path) + generate_junction(tmpdir, subproject_path, junction_path) # Create a stack element to depend on a cross junction element, using # colon (:) as the separator @@ -820,10 +817,9 @@ def test_build_junction_short_notation_with_junction(cli, tmpdir, 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') - checkout = os.path.join(cli.directory, 'checkout') # Create a repo to hold the subproject and generate a junction element for it - ref = generate_junction(tmpdir, subproject_path, junction_path) + generate_junction(tmpdir, subproject_path, junction_path) # Create a stack element to depend on a cross junction element, using # colon (:) as the separator @@ -848,10 +844,9 @@ def test_build_junction_short_notation_with_junction(cli, tmpdir, 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') - checkout = os.path.join(cli.directory, 'checkout') # Create a repo to hold the subproject and generate a junction element for it - ref = generate_junction(tmpdir, subproject_path, junction_path) + generate_junction(tmpdir, subproject_path, junction_path) # Create a stack element to depend on a cross junction element, using # colon (:) as the separator diff --git a/tests/frontend/completions.py b/tests/frontend/completions.py index c374df2a0..1f29fdae6 100644 --- a/tests/frontend/completions.py +++ b/tests/frontend/completions.py @@ -295,7 +295,7 @@ def test_help_commands(cli, cmd, word_idx, expected): @pytest.mark.datafiles(os.path.join(DATA_DIR, 'project')) -def test_argument_artifact(cli, tmpdir, datafiles): +def test_argument_artifact(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) # Build an import element with no dependencies (as there will only be ONE cache key) @@ -320,7 +320,7 @@ def test_argument_artifact(cli, tmpdir, datafiles): 'COMP_WORDS': cmd, 'COMP_CWORD': str(word_idx) }) - words = [] + if result.output: words = result.output.splitlines() # This leaves an extra space on each e.g. ['foo.bst '] words = [word.strip() for word in words] diff --git a/tests/frontend/configurable_warnings.py b/tests/frontend/configurable_warnings.py index 042874529..594c5a8e1 100644 --- a/tests/frontend/configurable_warnings.py +++ b/tests/frontend/configurable_warnings.py @@ -2,7 +2,7 @@ import pytest import os from buildstream.plugin import CoreWarnings -from buildstream._exceptions import ErrorDomain, LoadErrorReason +from buildstream._exceptions import ErrorDomain from buildstream import _yaml from buildstream.plugintestutils.runcli import cli diff --git a/tests/frontend/consistencyerror/plugins/consistencybug.py b/tests/frontend/consistencyerror/plugins/consistencybug.py index 39eeaa852..3c6fb46f3 100644 --- a/tests/frontend/consistencyerror/plugins/consistencybug.py +++ b/tests/frontend/consistencyerror/plugins/consistencybug.py @@ -1,4 +1,4 @@ -from buildstream import Source, SourceError, Consistency +from buildstream import Source class ConsistencyBugSource(Source): diff --git a/tests/frontend/consistencyerror/plugins/consistencyerror.py b/tests/frontend/consistencyerror/plugins/consistencyerror.py index 381e9e8f1..fe2037fc6 100644 --- a/tests/frontend/consistencyerror/plugins/consistencyerror.py +++ b/tests/frontend/consistencyerror/plugins/consistencyerror.py @@ -1,4 +1,4 @@ -from buildstream import Source, SourceError, Consistency +from buildstream import Source, SourceError class ConsistencyErrorSource(Source): diff --git a/tests/frontend/fetch.py b/tests/frontend/fetch.py index 9edfad94b..c6914fb3b 100644 --- a/tests/frontend/fetch.py +++ b/tests/frontend/fetch.py @@ -87,7 +87,7 @@ def test_fetch_default_targets(cli, tmpdir, datafiles): @pytest.mark.datafiles(os.path.join(TOP_DIR, 'consistencyerror')) -def test_fetch_consistency_error(cli, tmpdir, datafiles): +def test_fetch_consistency_error(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) # When the error occurs outside of the scheduler at load time, @@ -97,7 +97,7 @@ def test_fetch_consistency_error(cli, tmpdir, datafiles): @pytest.mark.datafiles(os.path.join(TOP_DIR, 'consistencyerror')) -def test_fetch_consistency_bug(cli, tmpdir, datafiles): +def test_fetch_consistency_bug(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) # FIXME: diff --git a/tests/frontend/logging.py b/tests/frontend/logging.py index 58ac4eeba..6ad792dc9 100644 --- a/tests/frontend/logging.py +++ b/tests/frontend/logging.py @@ -1,7 +1,7 @@ import os import pytest import re -from tests.testutils import create_repo, ALL_REPO_KINDS +from tests.testutils import create_repo from buildstream import _yaml from buildstream._exceptions import ErrorDomain @@ -85,7 +85,7 @@ def test_custom_logging(cli, tmpdir, datafiles): @pytest.mark.datafiles(DATA_DIR) -def test_failed_build_listing(cli, tmpdir, datafiles): +def test_failed_build_listing(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) element_names = [] for i in range(3): diff --git a/tests/frontend/mirror.py b/tests/frontend/mirror.py index c0c2e7059..aea7f49bf 100644 --- a/tests/frontend/mirror.py +++ b/tests/frontend/mirror.py @@ -93,9 +93,8 @@ def test_mirror_fetch(cli, tmpdir, datafiles, kind): # Create repo objects of the upstream and mirror upstream_repo = create_repo(kind, upstream_repodir) - upstream_ref = upstream_repo.create(bin_files_path) + upstream_repo.create(bin_files_path) mirror_repo = upstream_repo.copy(mirror_repodir) - mirror_ref = upstream_ref upstream_ref = upstream_repo.create(dev_files_path) element = { @@ -154,9 +153,8 @@ def test_mirror_fetch_ref_storage(cli, tmpdir, datafiles, ref_storage, mirror): # Create repo objects of the upstream and mirror upstream_repo = create_repo('tar', upstream_repodir) - upstream_ref = upstream_repo.create(bin_files_path) + upstream_repo.create(bin_files_path) mirror_repo = upstream_repo.copy(mirror_repodir) - mirror_ref = upstream_ref upstream_ref = upstream_repo.create(dev_files_path) element = { @@ -219,7 +217,6 @@ def test_mirror_fetch_ref_storage(cli, tmpdir, datafiles, ref_storage, mirror): @pytest.mark.datafiles(DATA_DIR) @pytest.mark.parametrize("kind", [(kind) for kind in ALL_REPO_KINDS]) def test_mirror_fetch_upstream_absent(cli, tmpdir, datafiles, kind): - bin_files_path = os.path.join(str(datafiles), 'files', 'bin-files', 'usr') dev_files_path = os.path.join(str(datafiles), 'files', 'dev-files', 'usr') upstream_repodir = os.path.join(str(tmpdir), 'upstream') mirror_repodir = os.path.join(str(tmpdir), 'mirror') @@ -274,7 +271,8 @@ def test_mirror_fetch_upstream_absent(cli, tmpdir, datafiles, kind): @pytest.mark.datafiles(DATA_DIR) -def test_mirror_fetch_multi(cli, tmpdir, datafiles): +@pytest.mark.usefixtures("datafiles") +def test_mirror_fetch_multi(cli, tmpdir): output_file = os.path.join(str(tmpdir), "output.txt") project_dir = str(tmpdir) element_dir = os.path.join(project_dir, 'elements') @@ -297,7 +295,8 @@ def test_mirror_fetch_multi(cli, tmpdir, datafiles): @pytest.mark.datafiles(DATA_DIR) -def test_mirror_fetch_default_cmdline(cli, tmpdir, datafiles): +@pytest.mark.usefixtures("datafiles") +def test_mirror_fetch_default_cmdline(cli, tmpdir): output_file = os.path.join(str(tmpdir), "output.txt") project_dir = str(tmpdir) element_dir = os.path.join(project_dir, 'elements') @@ -327,7 +326,8 @@ def test_mirror_fetch_default_cmdline(cli, tmpdir, datafiles): @pytest.mark.datafiles(DATA_DIR) -def test_mirror_fetch_default_userconfig(cli, tmpdir, datafiles): +@pytest.mark.usefixtures("datafiles") +def test_mirror_fetch_default_userconfig(cli, tmpdir): output_file = os.path.join(str(tmpdir), "output.txt") project_dir = str(tmpdir) element_dir = os.path.join(project_dir, 'elements') @@ -366,7 +366,8 @@ def test_mirror_fetch_default_userconfig(cli, tmpdir, datafiles): @pytest.mark.datafiles(DATA_DIR) -def test_mirror_fetch_default_cmdline_overrides_config(cli, tmpdir, datafiles): +@pytest.mark.usefixtures("datafiles") +def test_mirror_fetch_default_cmdline_overrides_config(cli, tmpdir): output_file = os.path.join(str(tmpdir), "output.txt") project_dir = str(tmpdir) element_dir = os.path.join(project_dir, 'elements') @@ -417,9 +418,8 @@ def test_mirror_track_upstream_present(cli, tmpdir, datafiles, kind): # Create repo objects of the upstream and mirror upstream_repo = create_repo(kind, upstream_repodir) - upstream_ref = upstream_repo.create(bin_files_path) + upstream_repo.create(bin_files_path) mirror_repo = upstream_repo.copy(mirror_repodir) - mirror_ref = upstream_ref upstream_ref = upstream_repo.create(dev_files_path) element = { @@ -613,7 +613,6 @@ def test_mirror_from_includes(cli, tmpdir, datafiles, kind): @pytest.mark.parametrize("kind", [(kind) for kind in ALL_REPO_KINDS]) def test_mirror_junction_from_includes(cli, tmpdir, datafiles, kind): bin_files_path = os.path.join(str(datafiles), 'files', 'bin-files', 'usr') - dev_files_path = os.path.join(str(datafiles), 'files', 'dev-files', 'usr') upstream_repodir = os.path.join(str(tmpdir), 'upstream') mirror_repodir = os.path.join(str(tmpdir), 'mirror') project_dir = os.path.join(str(tmpdir), 'project') @@ -698,19 +697,19 @@ def test_mirror_git_submodule_fetch(cli, tmpdir, datafiles): mirror_dir = os.path.join(str(datafiles), 'mirror') defined_subrepo = create_repo('git', str(tmpdir), 'defined_subrepo') - defined_mirror_ref = defined_subrepo.create(bin_files_path) - defined_mirror = defined_subrepo.copy(mirror_dir) - defined_subref = defined_subrepo.add_file(foo_file) + defined_subrepo.create(bin_files_path) + defined_subrepo.copy(mirror_dir) + defined_subrepo.add_file(foo_file) found_subrepo = create_repo('git', str(tmpdir), 'found_subrepo') - found_subref = found_subrepo.create(dev_files_path) + found_subrepo.create(dev_files_path) main_repo = create_repo('git', str(tmpdir)) main_mirror_ref = main_repo.create(bin_files_path) main_repo.add_submodule('defined', 'file://' + defined_subrepo.repo) main_repo.add_submodule('found', 'file://' + found_subrepo.repo) main_mirror = main_repo.copy(mirror_dir) - main_ref = main_repo.add_file(bar_file) + main_repo.add_file(bar_file) project_dir = os.path.join(str(tmpdir), 'project') os.makedirs(project_dir) diff --git a/tests/frontend/order.py b/tests/frontend/order.py index 422fce260..7982d993d 100644 --- a/tests/frontend/order.py +++ b/tests/frontend/order.py @@ -73,7 +73,7 @@ def create_element(project, name, dependencies): }, ['base.bst', 'middleware.bst', 'a.bst', 'app.bst', 'timezones.bst', 'target.bst']), ]) @pytest.mark.parametrize("operation", [('show'), ('fetch'), ('build')]) -def test_order(cli, datafiles, tmpdir, operation, target, template, expected): +def test_order(cli, datafiles, operation, target, template, expected): project = os.path.join(datafiles.dirname, datafiles.basename) # Configure to only allow one fetcher at a time, make it easy to diff --git a/tests/frontend/project/sources/fetch_source.py b/tests/frontend/project/sources/fetch_source.py index 10e89960c..d454f69e0 100644 --- a/tests/frontend/project/sources/fetch_source.py +++ b/tests/frontend/project/sources/fetch_source.py @@ -1,5 +1,4 @@ import os -import sys from buildstream import Source, Consistency, SourceError, SourceFetcher diff --git a/tests/frontend/pull.py b/tests/frontend/pull.py index 1326beccc..b24cb22f3 100644 --- a/tests/frontend/pull.py +++ b/tests/frontend/pull.py @@ -230,8 +230,6 @@ def test_push_pull_non_strict(cli, tmpdir, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) with create_artifact_share(os.path.join(str(tmpdir), 'artifactshare')) as share: - workspace = os.path.join(str(tmpdir), 'workspace') - # First build the target element and push to the remote. cli.configure({ 'artifacts': {'url': share.repo, 'push': True}, @@ -466,7 +464,7 @@ def test_build_remote_option(caplog, cli, tmpdir, datafiles): @pytest.mark.datafiles(DATA_DIR) -def test_pull_access_rights(caplog, cli, tmpdir, datafiles): +def test_pull_access_rights(cli, tmpdir, datafiles): project = str(datafiles) checkout = os.path.join(str(tmpdir), 'checkout') diff --git a/tests/frontend/push.py b/tests/frontend/push.py index 7a4cb3c0d..b573a7e41 100644 --- a/tests/frontend/push.py +++ b/tests/frontend/push.py @@ -26,7 +26,6 @@ import pytest from buildstream._exceptions import ErrorDomain from buildstream.plugintestutils import cli from tests.testutils import create_artifact_share, create_element_size, generate_junction, wait_for_cache_granularity -from . import configure_project # Project directory @@ -100,7 +99,7 @@ def test_push(cli, tmpdir, datafiles): {'url': share2.repo, 'push': True}, ] }) - result = cli.run(project=project, args=['artifact', 'push', 'target.bst']) + cli.run(project=project, args=['artifact', 'push', 'target.bst']) assert_not_shared(cli, share1, project, 'target.bst') assert_shared(cli, share2, project, 'target.bst') @@ -114,7 +113,7 @@ def test_push(cli, tmpdir, datafiles): {'url': share2.repo, 'push': True}, ] }) - result = cli.run(project=project, args=['artifact', 'push', 'target.bst']) + cli.run(project=project, args=['artifact', 'push', 'target.bst']) assert_shared(cli, share1, project, 'target.bst') assert_shared(cli, share2, project, 'target.bst') @@ -389,7 +388,7 @@ def test_push_cross_junction(cli, tmpdir, datafiles): cli.configure({ 'artifacts': {'url': share.repo, 'push': True}, }) - result = cli.run(project=project, args=['artifact', 'push', 'junction.bst:import-etc.bst']) + cli.run(project=project, args=['artifact', 'push', 'junction.bst:import-etc.bst']) cache_key = cli.get_element_key(project, 'junction.bst:import-etc.bst') assert share.has_artifact('subtest', 'import-etc.bst', cache_key) diff --git a/tests/frontend/rebuild.py b/tests/frontend/rebuild.py index 21f21fae3..5688f158e 100644 --- a/tests/frontend/rebuild.py +++ b/tests/frontend/rebuild.py @@ -19,7 +19,6 @@ def strict_args(args, strict): @pytest.mark.parametrize("strict", ["strict", "non-strict"]) def test_rebuild(datafiles, cli, strict): project = os.path.join(datafiles.dirname, datafiles.basename) - checkout = os.path.join(cli.directory, 'checkout') # 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 73cda9108..ddc971dc3 100644 --- a/tests/frontend/show.py +++ b/tests/frontend/show.py @@ -42,9 +42,7 @@ def test_show(cli, datafiles, target, format, expected): )) def test_show_invalid_element_path(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) - result = cli.run(project=project, silent=True, args=[ - 'show', - "foo.bst"]) + cli.run(project=project, silent=True, args=['show', "foo.bst"]) @pytest.mark.datafiles(os.path.join(DATA_DIR, 'project_default')) @@ -176,7 +174,7 @@ def test_show_except(cli, datafiles, targets, exceptions, expected): # Testing multiple targets # ############################################################### @pytest.mark.datafiles(os.path.join(DATA_DIR, 'project')) -def test_parallel_order(cli, tmpdir, datafiles): +def test_parallel_order(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) elements = ['multiple_targets/order/0.bst', 'multiple_targets/order/1.bst'] @@ -205,7 +203,7 @@ def test_parallel_order(cli, tmpdir, datafiles): @pytest.mark.datafiles(os.path.join(DATA_DIR, 'project')) -def test_target_is_dependency(cli, tmpdir, datafiles): +def test_target_is_dependency(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) elements = ['multiple_targets/dependency/zebry.bst', 'multiple_targets/dependency/horsey.bst'] diff --git a/tests/frontend/source_checkout.py b/tests/frontend/source_checkout.py index 1a83ba76e..8466767f9 100644 --- a/tests/frontend/source_checkout.py +++ b/tests/frontend/source_checkout.py @@ -1,12 +1,11 @@ import os import pytest import tarfile -from pathlib import Path from buildstream.plugintestutils import cli from buildstream import utils, _yaml -from buildstream._exceptions import ErrorDomain, LoadErrorReason +from buildstream._exceptions import ErrorDomain # Project directory DATA_DIR = os.path.join( diff --git a/tests/frontend/track.py b/tests/frontend/track.py index 486a4123c..1eadac8d9 100644 --- a/tests/frontend/track.py +++ b/tests/frontend/track.py @@ -44,7 +44,7 @@ def test_track(cli, tmpdir, datafiles, ref_storage, kind): # the dev files, and then collect the initial ref. # repo = create_repo(kind, str(tmpdir)) - ref = repo.create(dev_files_path) + repo.create(dev_files_path) # Generate the element generate_element(repo, os.path.join(element_path, element_name)) @@ -109,7 +109,7 @@ def test_track_recurse(cli, tmpdir, datafiles, kind, amount): # the dev files, and then collect the initial ref. # repo = create_repo(kind, str(tmpdir)) - ref = repo.create(dev_files_path) + repo.create(dev_files_path) # Write out our test targets element_names = [] @@ -164,7 +164,7 @@ def test_track_single(cli, tmpdir, datafiles): # the dev files, and then collect the initial ref. # repo = create_repo('git', str(tmpdir)) - ref = repo.create(dev_files_path) + repo.create(dev_files_path) # Write out our test targets generate_element(repo, os.path.join(element_path, element_dep_name)) @@ -207,7 +207,7 @@ def test_track_recurse_except(cli, tmpdir, datafiles, kind): # the dev files, and then collect the initial ref. # repo = create_repo(kind, str(tmpdir)) - ref = repo.create(dev_files_path) + repo.create(dev_files_path) # Write out our test targets generate_element(repo, os.path.join(element_path, element_dep_name)) @@ -251,7 +251,7 @@ def test_track_optional(cli, tmpdir, datafiles, ref_storage): # the dev files, and then collect the initial ref. # repo = create_repo('git', str(tmpdir)) - ref = repo.create(dev_files_path) + repo.create(dev_files_path) # Now create an optional test branch and add a commit to that, # so two branches with different heads now exist. @@ -307,7 +307,7 @@ def test_track_cross_junction(cli, tmpdir, datafiles, cross_junction, ref_storag # the dev files, and then collect the initial ref. # repo = create_repo('git', str(tmpdir)) - ref = repo.create(dev_files_path) + repo.create(dev_files_path) # Generate two elements using the git source, one in # the main project and one in the subproject. @@ -385,7 +385,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, tmpdir, datafiles): +def test_track_consistency_error(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) # Track the element causing a consistency error @@ -395,7 +395,7 @@ def test_track_consistency_error(cli, tmpdir, datafiles): @pytest.mark.datafiles(os.path.join(TOP_DIR, 'consistencyerror')) -def test_track_consistency_bug(cli, tmpdir, datafiles): +def test_track_consistency_bug(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) # Track the element causing an unhandled exception @@ -495,7 +495,7 @@ def test_cross_junction(cli, tmpdir, datafiles, ref_storage, kind): }) repo = create_repo(kind, str(tmpdir.join('element_repo'))) - ref = repo.create(etc_files) + repo.create(etc_files) generate_element(repo, repo_element_path) @@ -605,7 +605,7 @@ def test_track_include_junction(cli, tmpdir, datafiles, ref_storage, kind): # the dev files, and then collect the initial ref. # repo = create_repo(kind, str(tmpdir.join('element_repo'))) - ref = repo.create(dev_files_path) + repo.create(dev_files_path) # Generate the element element = { @@ -661,7 +661,6 @@ def test_track_junction_included(cli, tmpdir, datafiles, ref_storage, kind): project = os.path.join(datafiles.dirname, datafiles.basename) element_path = os.path.join(project, 'elements') subproject_path = os.path.join(project, 'files', 'sub-project') - sub_element_path = os.path.join(subproject_path, 'elements') junction_path = os.path.join(element_path, 'junction.bst') configure_project(project, { @@ -691,7 +690,7 @@ def test_track_error_cannot_write_file(cli, tmpdir, datafiles): }) repo = create_repo('git', str(tmpdir)) - ref = repo.create(dev_files_path) + repo.create(dev_files_path) element_full_path = os.path.join(element_path, element_name) generate_element(repo, element_full_path) diff --git a/tests/frontend/track_cross_junction.py b/tests/frontend/track_cross_junction.py index 7d9d468ae..e01ea81d9 100644 --- a/tests/frontend/track_cross_junction.py +++ b/tests/frontend/track_cross_junction.py @@ -28,10 +28,8 @@ def generate_import_element(tmpdir, kind, project, name): with open(os.path.join(files, '{}.txt'.format(name)), 'w') as f: f.write(name) - subproject_path = os.path.join(str(tmpdir.join('sub-project-{}'.format(name)))) - repo = create_repo(kind, str(tmpdir.join('element_{}_repo'.format(name)))) - ref = repo.create(files) + repo.create(files) generate_element(repo, repo_element_path) @@ -75,7 +73,7 @@ def generate_cross_element(project, subproject_name, import_name): @pytest.mark.parametrize("kind", [(kind) for kind in ALL_REPO_KINDS]) -def test_cross_junction_multiple_projects(cli, tmpdir, datafiles, kind): +def test_cross_junction_multiple_projects(cli, tmpdir, kind): tmpdir = tmpdir.join(kind) # Generate 3 projects: main, a, b @@ -126,7 +124,7 @@ def test_cross_junction_multiple_projects(cli, tmpdir, datafiles, kind): @pytest.mark.parametrize("kind", [(kind) for kind in ALL_REPO_KINDS]) -def test_track_exceptions(cli, tmpdir, datafiles, kind): +def test_track_exceptions(cli, tmpdir, kind): tmpdir = tmpdir.join(kind) _, project = generate_project(tmpdir, 'main', {'ref-storage': 'project.refs'}) diff --git a/tests/frontend/workspace.py b/tests/frontend/workspace.py index 7ca8064b8..0e834912c 100644 --- a/tests/frontend/workspace.py +++ b/tests/frontend/workspace.py @@ -29,13 +29,12 @@ import stat import pytest import shutil import subprocess -from ruamel.yaml.comments import CommentedSet from tests.testutils import create_repo, ALL_REPO_KINDS, wait_for_cache_granularity from tests.testutils import create_artifact_share, create_element_size from buildstream.plugintestutils import cli from buildstream import _yaml -from buildstream._exceptions import ErrorDomain, LoadError, LoadErrorReason +from buildstream._exceptions import ErrorDomain, LoadErrorReason from buildstream._workspaces import BST_WORKSPACE_FORMAT_VERSION repo_kinds = [(kind) for kind in ALL_REPO_KINDS] @@ -805,11 +804,8 @@ def test_detect_modifications(cli, tmpdir, datafiles, modification, strict): # Test loading a future version {"format-version": BST_WORKSPACE_FORMAT_VERSION + 1} ]) -def test_list_unsupported_workspace(cli, tmpdir, datafiles, workspace_cfg): +def test_list_unsupported_workspace(cli, datafiles, workspace_cfg): project = os.path.join(datafiles.dirname, datafiles.basename) - bin_files_path = os.path.join(project, 'files', 'bin-files') - element_path = os.path.join(project, 'elements') - element_name = 'workspace-version.bst' os.makedirs(os.path.join(project, '.bst')) workspace_config_path = os.path.join(project, '.bst', 'workspaces.yml') diff --git a/tests/frontend/yamlcache.py b/tests/frontend/yamlcache.py index 99b5d71c3..81514117e 100644 --- a/tests/frontend/yamlcache.py +++ b/tests/frontend/yamlcache.py @@ -1,10 +1,9 @@ import os import pytest -import hashlib import tempfile from ruamel import yaml -from tests.testutils import generate_junction, create_element_size, create_repo +from tests.testutils import generate_junction, create_element_size from buildstream.plugintestutils import cli from buildstream import _yaml from buildstream._yamlcache import YamlCache diff --git a/tests/integration/artifact.py b/tests/integration/artifact.py index 58e58bdcf..949d23c70 100644 --- a/tests/integration/artifact.py +++ b/tests/integration/artifact.py @@ -29,7 +29,6 @@ from buildstream.plugintestutils import cli_integration as cli from tests.testutils import create_artifact_share from tests.testutils.site import HAVE_SANDBOX from buildstream._cas import CASCache -from buildstream._exceptions import ErrorDomain pytestmark = pytest.mark.integration diff --git a/tests/integration/autotools.py b/tests/integration/autotools.py index 3ed0533cf..9c49ee9fd 100644 --- a/tests/integration/autotools.py +++ b/tests/integration/autotools.py @@ -20,7 +20,7 @@ DATA_DIR = os.path.join( @pytest.mark.integration @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') -def test_autotools_build(cli, tmpdir, datafiles): +def test_autotools_build(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) checkout = os.path.join(cli.directory, 'checkout') element_name = 'autotools/amhello.bst' @@ -43,7 +43,7 @@ def test_autotools_build(cli, tmpdir, datafiles): @pytest.mark.integration @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') -def test_autotools_confroot_build(cli, tmpdir, datafiles): +def test_autotools_confroot_build(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) checkout = os.path.join(cli.directory, 'checkout') element_name = 'autotools/amhelloconfroot.bst' @@ -64,7 +64,7 @@ def test_autotools_confroot_build(cli, tmpdir, datafiles): # Test running an executable built with autotools @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') -def test_autotools_run(cli, tmpdir, datafiles): +def test_autotools_run(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) element_name = 'autotools/amhello.bst' diff --git a/tests/integration/build-uid.py b/tests/integration/build-uid.py index 88b887b5e..c5e213085 100644 --- a/tests/integration/build-uid.py +++ b/tests/integration/build-uid.py @@ -1,10 +1,7 @@ import os import pytest -from buildstream import _yaml - from buildstream.plugintestutils import cli_integration as cli -from buildstream.plugintestutils.integration import assert_contains from tests.testutils.site import HAVE_BWRAP, IS_LINUX, HAVE_SANDBOX @@ -18,9 +15,8 @@ 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, tmpdir, datafiles): +def test_build_uid_overridden(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) - checkout = os.path.join(cli.directory, 'checkout') element_name = 'build-uid/build-uid.bst' project_config = { @@ -37,9 +33,8 @@ def test_build_uid_overridden(cli, tmpdir, 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, tmpdir, datafiles): +def test_build_uid_in_project(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) - checkout = os.path.join(cli.directory, 'checkout') element_name = 'build-uid/build-uid-1023.bst' project_config = { @@ -56,9 +51,8 @@ def test_build_uid_in_project(cli, tmpdir, 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, tmpdir, datafiles): +def test_build_uid_default(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) - checkout = os.path.join(cli.directory, 'checkout') 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 ad91ea978..108182b60 100644 --- a/tests/integration/cachedfail.py +++ b/tests/integration/cachedfail.py @@ -21,10 +21,9 @@ 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, tmpdir, datafiles): +def test_build_checkout_cached_fail(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) element_path = os.path.join(project, 'elements', 'element.bst') - workspace = os.path.join(cli.directory, 'workspace') checkout = os.path.join(cli.directory, 'checkout') # Write out our test target @@ -65,12 +64,10 @@ def test_build_checkout_cached_fail(cli, tmpdir, 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, tmpdir, datafiles): +def test_build_depend_on_cached_fail(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) dep_path = os.path.join(project, 'elements', 'dep.bst') target_path = os.path.join(project, 'elements', 'target.bst') - workspace = os.path.join(cli.directory, 'workspace') - checkout = os.path.join(cli.directory, 'checkout') dep = { 'kind': 'script', @@ -169,7 +166,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, tmpdir, datafiles): +def test_host_tools_errors_are_not_cached(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) element_path = os.path.join(project, 'elements', 'element.bst') diff --git a/tests/integration/cmake.py b/tests/integration/cmake.py index 51e215655..408f0deff 100644 --- a/tests/integration/cmake.py +++ b/tests/integration/cmake.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_cmake_build(cli, tmpdir, datafiles): +def test_cmake_build(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) checkout = os.path.join(cli.directory, 'checkout') element_name = 'cmake/cmakehello.bst' @@ -33,7 +33,7 @@ def test_cmake_build(cli, tmpdir, 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, tmpdir, datafiles): +def test_cmake_confroot_build(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) checkout = os.path.join(cli.directory, 'checkout') element_name = 'cmake/cmakeconfroothello.bst' @@ -49,7 +49,7 @@ def test_cmake_confroot_build(cli, tmpdir, datafiles): @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') -def test_cmake_run(cli, tmpdir, datafiles): +def test_cmake_run(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) element_name = 'cmake/cmakehello.bst' diff --git a/tests/integration/compose-symlinks.py b/tests/integration/compose-symlinks.py index 027feea7c..ee7689e6e 100644 --- a/tests/integration/compose-symlinks.py +++ b/tests/integration/compose-symlinks.py @@ -1,12 +1,7 @@ -import io import os -import sys import pytest -from buildstream import _yaml - from buildstream.plugintestutils import cli_integration as cli -from buildstream.plugintestutils.integration import walk_dir pytestmark = pytest.mark.integration @@ -21,11 +16,10 @@ DATA_DIR = os.path.join( # Test that staging a file inside a directory symlink fails. # # Regression test for https://gitlab.com/BuildStream/buildstream/issues/270 +# noinspection PyUnusedLocal @pytest.mark.datafiles(DATA_DIR) def test_compose_symlinks(cli, tmpdir, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) - checkout = os.path.join(cli.directory, 'checkout') - element_path = os.path.join(project, 'elements') # 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 386e08438..d15821d79 100644 --- a/tests/integration/compose.py +++ b/tests/integration/compose.py @@ -1,6 +1,4 @@ -import io import os -import sys import pytest from buildstream import _yaml @@ -76,7 +74,7 @@ def create_compose_element(name, path, config={}): '/usr/share/doc/amhello/README']) ]) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') -def test_compose_include(cli, tmpdir, datafiles, include_domains, +def test_compose_include(cli, datafiles, include_domains, exclude_domains, expected): project = os.path.join(datafiles.dirname, datafiles.basename) checkout = os.path.join(cli.directory, 'checkout') diff --git a/tests/integration/import.py b/tests/integration/import.py index deef66bc1..85cbf9cd1 100644 --- a/tests/integration/import.py +++ b/tests/integration/import.py @@ -42,7 +42,7 @@ def create_import_element(name, path, source, target, source_path): '/output/subdir', '/output/subdir/test.txt']), ]) -def test_import(cli, tmpdir, datafiles, source, target, path, expected): +def test_import(cli, datafiles, source, target, path, expected): project = os.path.join(datafiles.dirname, datafiles.basename) checkout = os.path.join(cli.directory, 'checkout') element_path = os.path.join(project, 'elements') diff --git a/tests/integration/make.py b/tests/integration/make.py index a76fe9a41..3839608f6 100644 --- a/tests/integration/make.py +++ b/tests/integration/make.py @@ -20,7 +20,7 @@ DATA_DIR = os.path.join( @pytest.mark.integration @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') -def test_make_build(cli, tmpdir, datafiles): +def test_make_build(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) checkout = os.path.join(cli.directory, 'checkout') element_name = 'make/makehello.bst' @@ -38,7 +38,7 @@ def test_make_build(cli, tmpdir, datafiles): # Test running an executable built with make @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') -def test_make_run(cli, tmpdir, datafiles): +def test_make_run(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) element_name = 'make/makehello.bst' diff --git a/tests/integration/manual.py b/tests/integration/manual.py index 97cbec537..507434eaa 100644 --- a/tests/integration/manual.py +++ b/tests/integration/manual.py @@ -33,7 +33,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, tmpdir, datafiles): +def test_manual_element(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) checkout = os.path.join(cli.directory, 'checkout') element_path = os.path.join(project, 'elements') @@ -67,7 +67,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, tmpdir, datafiles): +def test_manual_element_environment(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) checkout = os.path.join(cli.directory, 'checkout') element_path = os.path.join(project, 'elements') @@ -97,7 +97,7 @@ def test_manual_element_environment(cli, tmpdir, 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, tmpdir, datafiles): +def test_manual_element_noparallel(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) checkout = os.path.join(cli.directory, 'checkout') element_path = os.path.join(project, 'elements') @@ -132,9 +132,8 @@ def test_manual_element_noparallel(cli, tmpdir, 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, tmpdir, datafiles): +def test_manual_element_logging(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) - checkout = os.path.join(cli.directory, 'checkout') 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 7f4194e0f..b4ab3337c 100644 --- a/tests/integration/messages.py +++ b/tests/integration/messages.py @@ -39,7 +39,7 @@ DATA_DIR = os.path.join( @pytest.mark.integration @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') -def test_disable_message_lines(cli, tmpdir, datafiles): +def test_disable_message_lines(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) element_path = os.path.join(project, 'elements') element_name = 'message.bst' @@ -75,7 +75,7 @@ def test_disable_message_lines(cli, tmpdir, datafiles): @pytest.mark.integration @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') -def test_disable_error_lines(cli, tmpdir, datafiles): +def test_disable_error_lines(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) 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 48ca13bf5..d49e80d8d 100644 --- a/tests/integration/pip_element.py +++ b/tests/integration/pip_element.py @@ -1,5 +1,5 @@ import os -import sys + import pytest from buildstream import _yaml @@ -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_pip_build(cli, tmpdir, datafiles): +def test_pip_build(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) checkout = os.path.join(cli.directory, 'checkout') element_path = os.path.join(project, 'elements') @@ -57,9 +57,9 @@ def test_pip_build(cli, tmpdir, datafiles): # Test running an executable built with pip @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') -def test_pip_run(cli, tmpdir, datafiles): +def test_pip_run(cli, datafiles): # Create and build our test element - test_pip_build(cli, tmpdir, datafiles) + test_pip_build(cli, datafiles) project = os.path.join(datafiles.dirname, datafiles.basename) element_name = 'pip/hello.bst' diff --git a/tests/integration/pip_source.py b/tests/integration/pip_source.py index 993b3a182..7cda6d29b 100644 --- a/tests/integration/pip_source.py +++ b/tests/integration/pip_source.py @@ -19,7 +19,7 @@ DATA_DIR = os.path.join( @pytest.mark.datafiles(DATA_DIR) -def test_pip_source_import(cli, tmpdir, datafiles, setup_pypi_repo): +def test_pip_source_import(cli, datafiles, setup_pypi_repo): project = os.path.join(datafiles.dirname, datafiles.basename) checkout = os.path.join(cli.directory, 'checkout') element_path = os.path.join(project, 'elements') @@ -74,7 +74,7 @@ def test_pip_source_import(cli, tmpdir, 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, tmpdir, datafiles, setup_pypi_repo): +def test_pip_source_build(cli, datafiles, setup_pypi_repo): project = os.path.join(datafiles.dirname, datafiles.basename) 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 1d01ca383..efcf9cf87 100644 --- a/tests/integration/pullbuildtrees.py +++ b/tests/integration/pullbuildtrees.py @@ -8,9 +8,7 @@ from tests.testutils import create_artifact_share from tests.testutils.site import HAVE_SANDBOX from buildstream import utils -from buildstream.plugintestutils.integration import assert_contains from buildstream.plugintestutils import cli, cli_integration as cli2 -from buildstream.plugintestutils.integration import assert_contains from buildstream._cas import CASCache from buildstream._exceptions import ErrorDomain, LoadErrorReason @@ -178,7 +176,7 @@ def test_pullbuildtrees(cli2, tmpdir, datafiles): ("1", False) ]) @pytest.mark.datafiles(DATA_DIR) -def test_invalid_cache_pullbuildtrees(cli, datafiles, tmpdir, value, success): +def test_invalid_cache_pullbuildtrees(cli, datafiles, value, success): project = os.path.join(datafiles.dirname, datafiles.basename) cli.configure({ diff --git a/tests/integration/sandbox-bwrap.py b/tests/integration/sandbox-bwrap.py index 2c939e9be..206a3c387 100644 --- a/tests/integration/sandbox-bwrap.py +++ b/tests/integration/sandbox-bwrap.py @@ -4,7 +4,6 @@ import pytest from buildstream._exceptions import ErrorDomain from buildstream.plugintestutils import cli_integration as cli -from buildstream.plugintestutils.integration import assert_contains from tests.testutils.site import HAVE_BWRAP, HAVE_BWRAP_JSON_STATUS @@ -23,7 +22,7 @@ DATA_DIR = os.path.join( @pytest.mark.integration @pytest.mark.skipif(not HAVE_BWRAP, reason='Only available with bubblewrap') @pytest.mark.datafiles(DATA_DIR) -def test_sandbox_bwrap_cleanup_build(cli, tmpdir, datafiles): +def test_sandbox_bwrap_cleanup_build(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) # This element depends on a base image with non-empty `/tmp` folder. element_name = 'sandbox-bwrap/test-cleanup.bst' @@ -36,7 +35,7 @@ def test_sandbox_bwrap_cleanup_build(cli, tmpdir, datafiles): @pytest.mark.skipif(not HAVE_BWRAP, reason='Only available with bubblewrap') @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, tmpdir, datafiles): +def test_sandbox_bwrap_distinguish_setup_error(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) element_name = 'sandbox-bwrap/non-executable-shell.bst' @@ -47,7 +46,7 @@ def test_sandbox_bwrap_distinguish_setup_error(cli, tmpdir, datafiles): @pytest.mark.integration @pytest.mark.skipif(not HAVE_BWRAP, reason='Only available with bubblewrap') @pytest.mark.datafiles(DATA_DIR) -def test_sandbox_bwrap_return_subprocess(cli, tmpdir, datafiles): +def test_sandbox_bwrap_return_subprocess(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) element_name = 'sandbox-bwrap/command-exit-42.bst' diff --git a/tests/integration/script.py b/tests/integration/script.py index 0297a3f0a..db7da0ad5 100644 --- a/tests/integration/script.py +++ b/tests/integration/script.py @@ -31,7 +31,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, tmpdir, datafiles): +def test_script(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) checkout = os.path.join(cli.directory, 'checkout') element_path = os.path.join(project, 'elements') @@ -59,7 +59,7 @@ def test_script(cli, tmpdir, datafiles): @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') -def test_script_root(cli, tmpdir, datafiles): +def test_script_root(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) checkout = os.path.join(cli.directory, 'checkout') element_path = os.path.join(project, 'elements') @@ -91,7 +91,7 @@ def test_script_root(cli, tmpdir, 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, tmpdir, datafiles): +def test_script_no_root(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) element_path = os.path.join(project, 'elements') element_name = 'script/script-layout.bst' @@ -114,7 +114,7 @@ def test_script_no_root(cli, tmpdir, datafiles): @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') -def test_script_cwd(cli, tmpdir, datafiles): +def test_script_cwd(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) checkout = os.path.join(cli.directory, 'checkout') element_path = os.path.join(project, 'elements') @@ -145,7 +145,7 @@ def test_script_cwd(cli, tmpdir, datafiles): @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') -def test_script_layout(cli, tmpdir, datafiles): +def test_script_layout(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) checkout = os.path.join(cli.directory, 'checkout') element_name = 'script/script-layout.bst' @@ -164,7 +164,7 @@ def test_script_layout(cli, tmpdir, datafiles): @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') -def test_regression_cache_corruption(cli, tmpdir, datafiles): +def test_regression_cache_corruption(cli, datafiles): project = str(datafiles) checkout_original = os.path.join(cli.directory, 'checkout-original') checkout_after = os.path.join(cli.directory, 'checkout-after') @@ -194,7 +194,7 @@ def test_regression_cache_corruption(cli, tmpdir, datafiles): @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') -def test_regression_tmpdir(cli, tmpdir, datafiles): +def test_regression_tmpdir(cli, datafiles): project = str(datafiles) element_name = 'script/tmpdir.bst' @@ -204,7 +204,7 @@ def test_regression_tmpdir(cli, tmpdir, datafiles): @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') -def test_regression_cache_corruption_2(cli, tmpdir, datafiles): +def test_regression_cache_corruption_2(cli, datafiles): project = str(datafiles) checkout_original = os.path.join(cli.directory, 'checkout-original') checkout_after = os.path.join(cli.directory, 'checkout-after') diff --git a/tests/integration/shell.py b/tests/integration/shell.py index c4fb4e961..1a10df59e 100644 --- a/tests/integration/shell.py +++ b/tests/integration/shell.py @@ -2,7 +2,6 @@ import os import pytest from buildstream import _yaml -from buildstream._exceptions import ErrorDomain from buildstream.plugintestutils import cli_integration as cli from tests.testutils.site import HAVE_SANDBOX @@ -49,7 +48,7 @@ def execute_shell(cli, project, command, *, config=None, mount=None, element='ba # executable @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') -def test_shell(cli, tmpdir, datafiles): +def test_shell(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) result = execute_shell(cli, project, ["echo", "Ponies!"]) @@ -60,7 +59,7 @@ def test_shell(cli, tmpdir, datafiles): # Test running an executable directly @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') -def test_executable(cli, tmpdir, datafiles): +def test_executable(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) result = execute_shell(cli, project, ["/bin/echo", "Horseys!"]) @@ -72,7 +71,7 @@ def test_executable(cli, tmpdir, datafiles): @pytest.mark.parametrize("animal", [("Horse"), ("Pony")]) @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') -def test_env_assign(cli, tmpdir, datafiles, animal): +def test_env_assign(cli, datafiles, animal): project = os.path.join(datafiles.dirname, datafiles.basename) expected = animal + '\n' @@ -92,7 +91,7 @@ def test_env_assign(cli, tmpdir, datafiles, animal): @pytest.mark.parametrize("animal", [("Horse"), ("Pony")]) @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, tmpdir, datafiles, animal): +def test_env_assign_expand_host_environ(cli, datafiles, animal): project = os.path.join(datafiles.dirname, datafiles.basename) expected = 'The animal is: {}\n'.format(animal) @@ -115,7 +114,7 @@ def test_env_assign_expand_host_environ(cli, tmpdir, datafiles, animal): @pytest.mark.parametrize("animal", [("Horse"), ("Pony")]) @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') -def test_env_assign_isolated(cli, tmpdir, datafiles, animal): +def test_env_assign_isolated(cli, datafiles, animal): project = os.path.join(datafiles.dirname, datafiles.basename) result = execute_shell(cli, project, ['/bin/sh', '-c', 'echo ${ANIMAL}'], isolate=True, config={ 'shell': { @@ -133,7 +132,7 @@ def test_env_assign_isolated(cli, tmpdir, datafiles, animal): # /bin/sh) @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') -def test_no_shell(cli, tmpdir, datafiles): +def test_no_shell(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) element_path = os.path.join(project, 'elements') element_name = 'shell/no-shell.bst' @@ -166,7 +165,7 @@ def test_no_shell(cli, tmpdir, datafiles): @pytest.mark.parametrize("path", [("/etc/pony.conf"), ("/usr/share/pony/pony.txt")]) @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') -def test_host_files(cli, tmpdir, datafiles, path): +def test_host_files(cli, datafiles, path): project = os.path.join(datafiles.dirname, datafiles.basename) ponyfile = os.path.join(project, 'files', 'shell-mount', 'pony.txt') result = execute_shell(cli, project, ['cat', path], config={ @@ -187,7 +186,7 @@ def test_host_files(cli, tmpdir, datafiles, path): @pytest.mark.parametrize("path", [("/etc"), ("/usr/share/pony")]) @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, tmpdir, datafiles, path): +def test_host_files_expand_environ(cli, datafiles, path): project = os.path.join(datafiles.dirname, datafiles.basename) hostpath = os.path.join(project, 'files', 'shell-mount') fullpath = os.path.join(path, 'pony.txt') @@ -213,7 +212,7 @@ def test_host_files_expand_environ(cli, tmpdir, datafiles, path): @pytest.mark.parametrize("path", [("/etc/pony.conf"), ("/usr/share/pony/pony.txt")]) @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') -def test_isolated_no_mount(cli, tmpdir, datafiles, path): +def test_isolated_no_mount(cli, datafiles, path): project = os.path.join(datafiles.dirname, datafiles.basename) ponyfile = os.path.join(project, 'files', 'shell-mount', 'pony.txt') result = execute_shell(cli, project, ['cat', path], isolate=True, config={ @@ -236,7 +235,7 @@ def test_isolated_no_mount(cli, tmpdir, datafiles, path): @pytest.mark.parametrize("optional", [("mandatory"), ("optional")]) @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') -def test_host_files_missing(cli, tmpdir, datafiles, optional): +def test_host_files_missing(cli, datafiles, optional): project = os.path.join(datafiles.dirname, datafiles.basename) ponyfile = os.path.join(project, 'files', 'shell-mount', 'horsy.txt') @@ -272,7 +271,7 @@ def test_host_files_missing(cli, tmpdir, datafiles, optional): @pytest.mark.parametrize("path", [("/etc/pony.conf"), ("/usr/share/pony/pony.txt")]) @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') -def test_cli_mount(cli, tmpdir, datafiles, path): +def test_cli_mount(cli, datafiles, path): project = os.path.join(datafiles.dirname, datafiles.basename) ponyfile = os.path.join(project, 'files', 'shell-mount', 'pony.txt') @@ -285,7 +284,7 @@ def test_cli_mount(cli, tmpdir, datafiles, path): @pytest.mark.integration @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') -def test_workspace_visible(cli, tmpdir, datafiles): +def test_workspace_visible(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) workspace = os.path.join(cli.directory, 'workspace') element_name = 'workspace/workspace-mount-fail.bst' @@ -349,7 +348,7 @@ def test_sysroot(cli, tmpdir, datafiles): # Test system integration commands can access devices in /dev @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') -def test_integration_devices(cli, tmpdir, datafiles): +def test_integration_devices(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) element_name = 'integration.bst' diff --git a/tests/integration/shellbuildtrees.py b/tests/integration/shellbuildtrees.py index 3fd761f05..13d21548e 100644 --- a/tests/integration/shellbuildtrees.py +++ b/tests/integration/shellbuildtrees.py @@ -19,7 +19,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_buildtree_staged(cli_integration, tmpdir, datafiles): +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` @@ -37,7 +37,7 @@ def test_buildtree_staged(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_staged_forced_true(cli_integration, tmpdir, datafiles): +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) element_name = 'build-shell/buildtree.bst' @@ -77,7 +77,7 @@ def test_buildtree_staged_warn_empty_cached(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_staged_if_available(cli_integration, tmpdir, datafiles): +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) element_name = 'build-shell/buildtree.bst' @@ -94,7 +94,7 @@ def test_buildtree_staged_if_available(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_staged_forced_false(cli_integration, tmpdir, datafiles): +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) element_name = 'build-shell/buildtree.bst' @@ -112,7 +112,7 @@ def test_buildtree_staged_forced_false(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_from_failure(cli_integration, tmpdir, datafiles): +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) element_name = 'build-shell/buildtree-fail.bst' diff --git a/tests/integration/sockets.py b/tests/integration/sockets.py index fc2fb2b92..6dc6b682c 100644 --- a/tests/integration/sockets.py +++ b/tests/integration/sockets.py @@ -1,9 +1,7 @@ import os import pytest -from buildstream import _yaml from buildstream.plugintestutils import cli_integration as cli -from buildstream.plugintestutils.integration import assert_contains from tests.testutils.site import HAVE_SANDBOX @@ -17,7 +15,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, tmpdir, datafiles): +def test_builddir_socket_ignored(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) element_name = 'sockets/make-builddir-socket.bst' @@ -27,7 +25,7 @@ def test_builddir_socket_ignored(cli, tmpdir, 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, tmpdir, datafiles): +def test_install_root_socket_ignored(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) element_name = 'sockets/make-install-root-socket.bst' diff --git a/tests/integration/source-determinism.py b/tests/integration/source-determinism.py index 8ab11615a..9fc153e1a 100644 --- a/tests/integration/source-determinism.py +++ b/tests/integration/source-determinism.py @@ -1,7 +1,7 @@ import os import pytest -from buildstream import _yaml, utils +from buildstream import _yaml from buildstream.plugintestutils import cli_integration as cli from tests.testutils import create_repo, ALL_REPO_KINDS from tests.testutils.site import HAVE_SANDBOX diff --git a/tests/integration/stack.py b/tests/integration/stack.py index d5208d7be..f8c837bbb 100644 --- a/tests/integration/stack.py +++ b/tests/integration/stack.py @@ -1,7 +1,6 @@ import os import pytest -from buildstream import _yaml from buildstream.plugintestutils import cli_integration as cli from tests.testutils.site import HAVE_SANDBOX @@ -17,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_stack(cli, tmpdir, datafiles): +def test_stack(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) 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 5db09d3d0..1c2f3c2a7 100644 --- a/tests/integration/symlinks.py +++ b/tests/integration/symlinks.py @@ -1,11 +1,7 @@ import os -import shlex import pytest -from buildstream import _yaml - from buildstream.plugintestutils import cli_integration as cli -from buildstream.plugintestutils.integration import assert_contains from tests.testutils.site import HAVE_SANDBOX @@ -20,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_absolute_symlinks(cli, tmpdir, datafiles): +def test_absolute_symlinks(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) checkout = os.path.join(cli.directory, 'checkout') element_name = 'symlinks/dangling-symlink.bst' @@ -41,7 +37,7 @@ def test_absolute_symlinks(cli, tmpdir, 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, tmpdir, datafiles): +def test_disallow_overlaps_inside_symlink_with_dangling_target(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) checkout = os.path.join(cli.directory, 'checkout') element_name = 'symlinks/dangling-symlink-overlap.bst' @@ -56,7 +52,7 @@ def test_disallow_overlaps_inside_symlink_with_dangling_target(cli, tmpdir, data @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, tmpdir, datafiles): +def test_detect_symlink_overlaps_pointing_outside_sandbox(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) 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 f1d8d6fcd..88a4a1f84 100644 --- a/tests/integration/workspace.py +++ b/tests/integration/workspace.py @@ -4,7 +4,6 @@ import pytest from buildstream import _yaml from buildstream.plugintestutils import cli_integration as cli from tests.testutils.site import HAVE_SANDBOX -from buildstream.plugintestutils.integration import walk_dir pytestmark = pytest.mark.integration @@ -19,7 +18,7 @@ DATA_DIR = os.path.join( @pytest.mark.integration @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') -def test_workspace_mount(cli, tmpdir, datafiles): +def test_workspace_mount(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) workspace = os.path.join(cli.directory, 'workspace') element_name = 'workspace/workspace-mount.bst' @@ -36,7 +35,7 @@ def test_workspace_mount(cli, tmpdir, datafiles): @pytest.mark.integration @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') -def test_workspace_commanddir(cli, tmpdir, datafiles): +def test_workspace_commanddir(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) workspace = os.path.join(cli.directory, 'workspace') element_name = 'workspace/workspace-commanddir.bst' @@ -54,7 +53,7 @@ def test_workspace_commanddir(cli, tmpdir, datafiles): @pytest.mark.integration @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') -def test_workspace_updated_dependency(cli, tmpdir, datafiles): +def test_workspace_updated_dependency(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) workspace = os.path.join(cli.directory, 'workspace') element_path = os.path.join(project, 'elements') @@ -109,7 +108,7 @@ def test_workspace_updated_dependency(cli, tmpdir, datafiles): @pytest.mark.integration @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, tmpdir, datafiles): +def test_workspace_update_dependency_failed(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) workspace = os.path.join(cli.directory, 'workspace') element_path = os.path.join(project, 'elements') @@ -185,7 +184,7 @@ def test_workspace_update_dependency_failed(cli, tmpdir, datafiles): @pytest.mark.integration @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') -def test_updated_dependency_nested(cli, tmpdir, datafiles): +def test_updated_dependency_nested(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) workspace = os.path.join(cli.directory, 'workspace') element_path = os.path.join(project, 'elements') @@ -239,7 +238,7 @@ def test_updated_dependency_nested(cli, tmpdir, datafiles): @pytest.mark.integration @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, tmpdir, datafiles): +def test_incremental_configure_commands_run_only_once(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) workspace = os.path.join(cli.directory, 'workspace') element_path = os.path.join(project, 'elements') diff --git a/tests/internals/loader.py b/tests/internals/loader.py index 87a5c3b35..8fe75770d 100644 --- a/tests/internals/loader.py +++ b/tests/internals/loader.py @@ -4,7 +4,8 @@ import pytest from buildstream._exceptions import LoadError, LoadErrorReason from buildstream._context import Context from buildstream._project import Project -from buildstream._loader import Loader, MetaElement +from buildstream._loader import MetaElement + DATA_DIR = os.path.join( os.path.dirname(os.path.realpath(__file__)), @@ -46,7 +47,7 @@ def test_missing_file(datafiles): loader = make_loader(basedir) with pytest.raises(LoadError) as exc: - element = loader.load(['elements/missing.bst'])[0] + loader.load(['elements/missing.bst'])[0] assert (exc.value.reason == LoadErrorReason.MISSING_FILE) @@ -58,7 +59,7 @@ def test_invalid_reference(datafiles): loader = make_loader(basedir) with pytest.raises(LoadError) as exc: - element = loader.load(['elements/badreference.bst'])[0] + loader.load(['elements/badreference.bst'])[0] assert (exc.value.reason == LoadErrorReason.INVALID_YAML) @@ -70,7 +71,7 @@ def test_invalid_yaml(datafiles): loader = make_loader(basedir) with pytest.raises(LoadError) as exc: - element = loader.load(['elements/badfile.bst'])[0] + loader.load(['elements/badfile.bst'])[0] assert (exc.value.reason == LoadErrorReason.INVALID_YAML) @@ -95,7 +96,7 @@ def test_invalid_key(datafiles): loader = make_loader(basedir) with pytest.raises(LoadError) as exc: - element = loader.load(['elements/invalidkey.bst'])[0] + loader.load(['elements/invalidkey.bst'])[0] assert (exc.value.reason == LoadErrorReason.INVALID_DATA) @@ -107,6 +108,6 @@ def test_invalid_directory_load(datafiles): loader = make_loader(basedir) with pytest.raises(LoadError) as exc: - element = loader.load(['elements/'])[0] + loader.load(['elements/'])[0] assert (exc.value.reason == LoadErrorReason.LOADING_DIRECTORY) diff --git a/tests/internals/pluginfactory.py b/tests/internals/pluginfactory.py index 28ab039bd..ec4516736 100644 --- a/tests/internals/pluginfactory.py +++ b/tests/internals/pluginfactory.py @@ -79,8 +79,8 @@ def test_missing_source(plugin_fixture): assert(isinstance(factory, SourceFactory)) # Test fails if PluginError is not raised - with pytest.raises(PluginError) as exc: - foo_type = factory.lookup('foo') + with pytest.raises(PluginError): + factory.lookup('foo') def test_missing_element(plugin_fixture): @@ -88,8 +88,8 @@ def test_missing_element(plugin_fixture): assert(isinstance(factory, ElementFactory)) # Test fails if PluginError is not raised - with pytest.raises(PluginError) as exc: - foo_type = factory.lookup('foo') + with pytest.raises(PluginError): + factory.lookup('foo') # Load a factory with a plugin that returns a value instead of Source subclass @@ -102,8 +102,8 @@ def test_source_notatype(plugin_fixture, datafiles): 'plugins': {'foo': 0} }] factory = SourceFactory(plugin_fixture['base'], plugin_origins=plugins) - with pytest.raises(PluginError) as exc: - foo_type = factory.lookup('foo') + with pytest.raises(PluginError): + factory.lookup('foo') # Load a factory with a plugin that returns a value instead of Element subclass @@ -116,8 +116,8 @@ def test_element_notatype(plugin_fixture, datafiles): 'plugins': {'foo': 0} }] factory = ElementFactory(plugin_fixture['base'], plugin_origins=plugins) - with pytest.raises(PluginError) as exc: - foo_type = factory.lookup('foo') + with pytest.raises(PluginError): + factory.lookup('foo') # Load a factory with a plugin that returns a type @@ -131,8 +131,8 @@ def test_source_wrongtype(plugin_fixture, datafiles): 'plugins': {'foo': 0} }] factory = SourceFactory(plugin_fixture['base'], plugin_origins=plugins) - with pytest.raises(PluginError) as exc: - foo_type = factory.lookup('foo') + with pytest.raises(PluginError): + factory.lookup('foo') # Load a factory with a plugin that returns a type @@ -146,8 +146,8 @@ def test_element_wrongtype(plugin_fixture, datafiles): 'plugins': {'foo': 0} }] factory = ElementFactory(plugin_fixture['base'], plugin_origins=plugins) - with pytest.raises(PluginError) as exc: - foo_type = factory.lookup('foo') + with pytest.raises(PluginError): + factory.lookup('foo') # Load a factory with a plugin which fails to provide a setup() function @@ -160,8 +160,8 @@ def test_source_missing_setup(plugin_fixture, datafiles): 'plugins': {'foo': 0} }] factory = SourceFactory(plugin_fixture['base'], plugin_origins=plugins) - with pytest.raises(PluginError) as exc: - foo_type = factory.lookup('foo') + with pytest.raises(PluginError): + factory.lookup('foo') # Load a factory with a plugin which fails to provide a setup() function @@ -174,8 +174,8 @@ def test_element_missing_setup(plugin_fixture, datafiles): 'plugins': {'foo': 0} }] factory = ElementFactory(plugin_fixture['base'], plugin_origins=plugins) - with pytest.raises(PluginError) as exc: - foo_type = factory.lookup('foo') + with pytest.raises(PluginError): + factory.lookup('foo') # Load a factory with a plugin which provides a setup symbol @@ -189,8 +189,8 @@ def test_source_bad_setup(plugin_fixture, datafiles): 'plugins': {'foo': 0} }] factory = SourceFactory(plugin_fixture['base'], plugin_origins=plugins) - with pytest.raises(PluginError) as exc: - foo_type = factory.lookup('foo') + with pytest.raises(PluginError): + factory.lookup('foo') # Load a factory with a plugin which provides a setup symbol @@ -204,8 +204,8 @@ def test_element_bad_setup(plugin_fixture, datafiles): 'plugins': {'foo': 0} }] factory = ElementFactory(plugin_fixture['base'], plugin_origins=plugins) - with pytest.raises(PluginError) as exc: - foo_type = factory.lookup('foo') + with pytest.raises(PluginError): + factory.lookup('foo') # Load a factory with a plugin which requires an absurdly @@ -219,8 +219,8 @@ def test_source_badversion(plugin_fixture, datafiles): 'plugins': {'foo': 0} }] factory = SourceFactory(plugin_fixture['base'], plugin_origins=plugins) - with pytest.raises(PluginError) as exc: - foo_type = factory.lookup('foo') + with pytest.raises(PluginError): + factory.lookup('foo') # Load a factory with a plugin which requires an absurdly @@ -234,8 +234,8 @@ def test_element_badversion(plugin_fixture, datafiles): 'plugins': {'foo': 0} }] factory = ElementFactory(plugin_fixture['base'], plugin_origins=plugins) - with pytest.raises(PluginError) as exc: - foo_type = factory.lookup('foo') + with pytest.raises(PluginError): + factory.lookup('foo') ############################################################## diff --git a/tests/internals/pluginloading.py b/tests/internals/pluginloading.py index 607d253ee..e14071718 100644 --- a/tests/internals/pluginloading.py +++ b/tests/internals/pluginloading.py @@ -50,7 +50,7 @@ def test_badversionsource(datafiles, tmpdir): basedir = os.path.join(datafiles.dirname, datafiles.basename) with pytest.raises(LoadError) as exc: - targets = create_pipeline(tmpdir, basedir, 'simple.bst') + create_pipeline(tmpdir, basedir, 'simple.bst') assert exc.value.reason == LoadErrorReason.UNSUPPORTED_PLUGIN @@ -60,6 +60,6 @@ def test_badversionelement(datafiles, tmpdir): basedir = os.path.join(datafiles.dirname, datafiles.basename) with pytest.raises(LoadError) as exc: - targets = create_pipeline(tmpdir, basedir, 'simple.bst') + create_pipeline(tmpdir, basedir, 'simple.bst') assert exc.value.reason == LoadErrorReason.UNSUPPORTED_PLUGIN diff --git a/tests/internals/storage.py b/tests/internals/storage.py index c09ff4380..36d9442c5 100644 --- a/tests/internals/storage.py +++ b/tests/internals/storage.py @@ -1,7 +1,6 @@ import os -import pytest -from buildstream._exceptions import ErrorDomain +import pytest from buildstream._cas import CASCache from buildstream.storage._casbaseddirectory import CasBasedDirectory diff --git a/tests/internals/storage_vdir_import.py b/tests/internals/storage_vdir_import.py index 268bfb21f..616f740e2 100644 --- a/tests/internals/storage_vdir_import.py +++ b/tests/internals/storage_vdir_import.py @@ -2,14 +2,11 @@ from hashlib import sha256 import os import pytest import random -import tempfile from buildstream.plugintestutils import cli from buildstream.storage._casbaseddirectory import CasBasedDirectory from buildstream.storage._filebaseddirectory import FileBasedDirectory -from buildstream._artifactcache import ArtifactCache from buildstream._cas import CASCache -from buildstream import utils # These are comparitive tests that check that FileBasedDirectory and @@ -221,13 +218,13 @@ def _import_test(tmpdir, original, overlay, generator_function, verify_contents= # but this leads to more tests being listed in the output than are # comfortable. @pytest.mark.parametrize("original", range(1, len(root_filesets) + 1)) -def test_fixed_cas_import(cli, tmpdir, original): +def test_fixed_cas_import(tmpdir, original): for overlay in range(1, len(root_filesets) + 1): _import_test(str(tmpdir), original, overlay, generate_import_roots, verify_contents=True) @pytest.mark.parametrize("original", range(1, NUM_RANDOM_TESTS + 1)) -def test_random_cas_import(cli, tmpdir, original): +def test_random_cas_import(tmpdir, original): for overlay in range(1, NUM_RANDOM_TESTS + 1): _import_test(str(tmpdir), original, overlay, generate_random_root, verify_contents=False) @@ -247,10 +244,10 @@ def _listing_test(tmpdir, root, generator_function): @pytest.mark.parametrize("root", range(1, 11)) -def test_random_directory_listing(cli, tmpdir, root): +def test_random_directory_listing(tmpdir, root): _listing_test(str(tmpdir), root, generate_random_root) @pytest.mark.parametrize("root", [1, 2, 3, 4, 5]) -def test_fixed_directory_listing(cli, tmpdir, root): +def test_fixed_directory_listing(tmpdir, root): _listing_test(str(tmpdir), root, generate_import_roots) diff --git a/tests/internals/yaml.py b/tests/internals/yaml.py index bc513deb4..b2d96256d 100644 --- a/tests/internals/yaml.py +++ b/tests/internals/yaml.py @@ -119,7 +119,7 @@ def test_node_get(datafiles): extra = _yaml.node_get(base, Mapping, 'extra') with pytest.raises(LoadError) as exc: - wrong = _yaml.node_get(extra, Mapping, 'old') + _yaml.node_get(extra, Mapping, 'old') assert (exc.value.reason == LoadErrorReason.INVALID_DATA) @@ -409,5 +409,5 @@ def test_value_doesnt_match_expected(datafiles): test_dict = _yaml.load(conf_file) with pytest.raises(LoadError) as exc: - user_config = _yaml.node_get(test_dict, int, "Test4") + _yaml.node_get(test_dict, int, "Test4") assert exc.value.reason == LoadErrorReason.INVALID_DATA diff --git a/tests/plugins/deprecationwarnings/deprecationwarnings.py b/tests/plugins/deprecationwarnings/deprecationwarnings.py index 799f162dc..10b93cc7a 100644 --- a/tests/plugins/deprecationwarnings/deprecationwarnings.py +++ b/tests/plugins/deprecationwarnings/deprecationwarnings.py @@ -1,9 +1,6 @@ import pytest -import tempfile import os from buildstream.plugintestutils import cli -from buildstream import _yaml -import buildstream.plugins.elements.manual DATA_DIR = os.path.join( @@ -26,7 +23,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) - result = cli.run(project=project, args=['show', 'manual.bst']) + cli.run(project=project, args=['show', 'manual.bst']) element_overrides = "elements:\n" \ " deprecated_plugin:\n" \ diff --git a/tests/plugins/deprecationwarnings/project/plugins/elements/deprecated_plugin.py b/tests/plugins/deprecationwarnings/project/plugins/elements/deprecated_plugin.py index a8e39562a..1badf59af 100644 --- a/tests/plugins/deprecationwarnings/project/plugins/elements/deprecated_plugin.py +++ b/tests/plugins/deprecationwarnings/project/plugins/elements/deprecated_plugin.py @@ -1,4 +1,4 @@ -from buildstream import BuildElement, SandboxFlags +from buildstream import BuildElement class DeprecatedPlugin(BuildElement): diff --git a/tests/sandboxes/missing-command.py b/tests/sandboxes/missing-command.py index ddf1c487f..a2b56d4a7 100644 --- a/tests/sandboxes/missing-command.py +++ b/tests/sandboxes/missing-command.py @@ -13,7 +13,7 @@ DATA_DIR = os.path.join( @pytest.mark.datafiles(DATA_DIR) -def test_missing_command(cli, tmpdir, datafiles): +def test_missing_command(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) result = cli.run(project=project, args=['build', 'no-runtime.bst']) result.assert_task_error(ErrorDomain.SANDBOX, 'missing-command') diff --git a/tests/sandboxes/mounting/mount_simple.py b/tests/sandboxes/mounting/mount_simple.py index 449de43e5..65aaf209d 100644 --- a/tests/sandboxes/mounting/mount_simple.py +++ b/tests/sandboxes/mounting/mount_simple.py @@ -26,7 +26,7 @@ def test_bind_mount(): # Ensure the files from src are gone from target with pytest.raises(FileNotFoundError): - with open(os.path.join(target, 'test'), 'r') as test: + with open(os.path.join(target, 'test'), 'r'): # Actual contents don't matter pass diff --git a/tests/sandboxes/remote-exec-config.py b/tests/sandboxes/remote-exec-config.py index 9864f2591..31ba11678 100644 --- a/tests/sandboxes/remote-exec-config.py +++ b/tests/sandboxes/remote-exec-config.py @@ -1,6 +1,5 @@ import pytest -import itertools import os from buildstream import _yaml diff --git a/tests/sources/bzr.py b/tests/sources/bzr.py index bf7d1e844..3ff51bc2e 100644 --- a/tests/sources/bzr.py +++ b/tests/sources/bzr.py @@ -1,7 +1,6 @@ import os import pytest -from buildstream._pipeline import PipelineError from buildstream import _yaml from buildstream.plugintestutils import cli diff --git a/tests/sources/deb.py b/tests/sources/deb.py index 480bea6f4..766f6fcc9 100644 --- a/tests/sources/deb.py +++ b/tests/sources/deb.py @@ -1,13 +1,9 @@ import os import pytest -import tarfile -import tempfile -import subprocess import shutil from buildstream._exceptions import ErrorDomain from buildstream import _yaml -from tempfile import TemporaryFile from buildstream.plugintestutils import cli from tests.testutils.site import HAVE_ARPY from . import list_dir_contents diff --git a/tests/sources/git.py b/tests/sources/git.py index 98891a9af..40df30ac6 100644 --- a/tests/sources/git.py +++ b/tests/sources/git.py @@ -30,7 +30,6 @@ from buildstream import _yaml from buildstream.plugin import CoreWarnings from buildstream.plugintestutils import cli -from tests.testutils.site import HAVE_GIT, HAVE_OLD_GIT from tests.testutils import create_repo from tests.testutils.site import HAVE_GIT, HAVE_OLD_GIT @@ -47,7 +46,7 @@ def test_fetch_bad_ref(cli, tmpdir, datafiles): # Create the repo from 'repofiles' subdir repo = create_repo('git', str(tmpdir)) - ref = repo.create(os.path.join(project, 'repofiles')) + repo.create(os.path.join(project, 'repofiles')) # Write out our test target with a bad ref element = { @@ -74,11 +73,11 @@ def test_submodule_fetch_checkout(cli, tmpdir, datafiles): # Create the submodule first from the 'subrepofiles' subdir subrepo = create_repo('git', str(tmpdir), 'subrepo') - subref = subrepo.create(os.path.join(project, 'subrepofiles')) + subrepo.create(os.path.join(project, 'subrepofiles')) # Create the repo from 'repofiles' subdir repo = create_repo('git', str(tmpdir)) - ref = repo.create(os.path.join(project, 'repofiles')) + repo.create(os.path.join(project, 'repofiles')) # Add a submodule pointing to the one we created ref = repo.add_submodule('subdir', 'file://' + subrepo.repo) @@ -117,7 +116,7 @@ def test_submodule_fetch_source_enable_explicit(cli, tmpdir, datafiles): # Create the repo from 'repofiles' subdir repo = create_repo('git', str(tmpdir)) - ref = repo.create(os.path.join(project, 'repofiles')) + repo.create(os.path.join(project, 'repofiles')) # Add a submodule pointing to the one we created ref = repo.add_submodule('subdir', 'file://' + subrepo.repo) @@ -156,7 +155,7 @@ def test_submodule_fetch_source_disable(cli, tmpdir, datafiles): # Create the repo from 'repofiles' subdir repo = create_repo('git', str(tmpdir)) - ref = repo.create(os.path.join(project, 'repofiles')) + repo.create(os.path.join(project, 'repofiles')) # Add a submodule pointing to the one we created ref = repo.add_submodule('subdir', 'file://' + subrepo.repo) @@ -195,7 +194,7 @@ def test_submodule_fetch_submodule_does_override(cli, tmpdir, datafiles): # Create the repo from 'repofiles' subdir repo = create_repo('git', str(tmpdir)) - ref = repo.create(os.path.join(project, 'repofiles')) + repo.create(os.path.join(project, 'repofiles')) # Add a submodule pointing to the one we created ref = repo.add_submodule('subdir', 'file://' + subrepo.repo, checkout=True) @@ -238,10 +237,10 @@ def test_submodule_fetch_submodule_individual_checkout(cli, tmpdir, datafiles): # Create the repo from 'repofiles' subdir repo = create_repo('git', str(tmpdir)) - ref = repo.create(os.path.join(project, 'repofiles')) + repo.create(os.path.join(project, 'repofiles')) # Add a submodule pointing to the one we created - ref = repo.add_submodule('subdir', 'file://' + subrepo.repo, checkout=False) + repo.add_submodule('subdir', 'file://' + subrepo.repo, checkout=False) ref = repo.add_submodule('othersubdir', 'file://' + other_subrepo.repo) # Write out our test target @@ -283,10 +282,10 @@ def test_submodule_fetch_submodule_individual_checkout_explicit(cli, tmpdir, dat # Create the repo from 'repofiles' subdir repo = create_repo('git', str(tmpdir)) - ref = repo.create(os.path.join(project, 'repofiles')) + repo.create(os.path.join(project, 'repofiles')) # Add a submodule pointing to the one we created - ref = repo.add_submodule('subdir', 'file://' + subrepo.repo, checkout=False) + repo.add_submodule('subdir', 'file://' + subrepo.repo, checkout=False) ref = repo.add_submodule('othersubdir', 'file://' + other_subrepo.repo, checkout=True) # Write out our test target @@ -324,7 +323,7 @@ def test_submodule_fetch_project_override(cli, tmpdir, datafiles): # Create the repo from 'repofiles' subdir repo = create_repo('git', str(tmpdir)) - ref = repo.create(os.path.join(project, 'repofiles')) + repo.create(os.path.join(project, 'repofiles')) # Add a submodule pointing to the one we created ref = repo.add_submodule('subdir', 'file://' + subrepo.repo) @@ -395,7 +394,7 @@ def test_submodule_track_no_ref_or_track(cli, tmpdir, datafiles): # Create the repo from 'repofiles' subdir repo = create_repo('git', str(tmpdir)) - ref = repo.create(os.path.join(project, 'repofiles')) + repo.create(os.path.join(project, 'repofiles')) # Write out our test target gitsource = repo.source_config(ref=None) @@ -478,7 +477,7 @@ def test_unlisted_submodule(cli, tmpdir, datafiles, fail): # Create the repo from 'repofiles' subdir repo = create_repo('git', str(tmpdir)) - ref = repo.create(os.path.join(project, 'repofiles')) + repo.create(os.path.join(project, 'repofiles')) # Add a submodule pointing to the one we created ref = repo.add_submodule('subdir', 'file://' + subrepo.repo) @@ -686,7 +685,7 @@ def test_track_invalid_submodule(cli, tmpdir, datafiles, fail): # Create the repo from 'repofiles' subdir repo = create_repo('git', str(tmpdir)) - ref = repo.create(os.path.join(project, 'repofiles')) + repo.create(os.path.join(project, 'repofiles')) # Add a submodule pointing to the one we created ref = repo.add_submodule('subdir', 'file://' + subrepo.repo) @@ -736,7 +735,7 @@ def test_track_fetch(cli, tmpdir, datafiles, ref_format, tag, extra_commit): # Create the repo from 'repofiles' subdir repo = create_repo('git', str(tmpdir)) - ref = repo.create(os.path.join(project, 'repofiles')) + repo.create(os.path.join(project, 'repofiles')) if tag: repo.add_tag('tag') if extra_commit: @@ -800,7 +799,7 @@ def test_git_describe(cli, tmpdir, datafiles, ref_storage, tag_type): else: repo.add_tag(name) - ref = repo.create(repofiles) + repo.create(repofiles) tag('uselesstag') file1 = os.path.join(str(tmpdir), 'file1') @@ -912,7 +911,7 @@ def test_git_describe_head_is_tagged(cli, tmpdir, datafiles, ref_storage, tag_ty else: repo.add_tag(name) - ref = repo.create(repofiles) + repo.create(repofiles) tag('uselesstag') file1 = os.path.join(str(tmpdir), 'file1') @@ -1093,7 +1092,7 @@ def test_default_do_not_track_tags(cli, tmpdir, datafiles): repo = create_repo('git', str(tmpdir)) - ref = repo.create(repofiles) + repo.create(repofiles) repo.add_tag('tag') config = repo.source_config() @@ -1191,7 +1190,7 @@ def test_overwrite_rogue_tag_multiple_remotes(cli, tmpdir, datafiles): otherpath = os.path.join(str(tmpdir), 'other_path') shutil.copytree(repo.repo, os.path.join(otherpath, 'repo')) - new_repo = create_repo('git', otherpath) + create_repo('git', otherpath) repodir, reponame = os.path.split(repo.repo) diff --git a/tests/sources/local.py b/tests/sources/local.py index 0da9e8cc1..c494e2671 100644 --- a/tests/sources/local.py +++ b/tests/sources/local.py @@ -12,7 +12,7 @@ DATA_DIR = os.path.join( @pytest.mark.datafiles(os.path.join(DATA_DIR, 'basic')) -def test_missing_path(cli, tmpdir, datafiles): +def test_missing_path(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) # Removing the local file causes preflight to fail @@ -26,11 +26,11 @@ def test_missing_path(cli, tmpdir, datafiles): @pytest.mark.datafiles(os.path.join(DATA_DIR, 'basic')) -def test_non_regular_file_or_directory(cli, tmpdir, datafiles): +def test_non_regular_file_or_directory(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) localfile = os.path.join(project, 'file.txt') - for file_type in filetypegenerator.generate_file_types(localfile): + for _file_type in filetypegenerator.generate_file_types(localfile): result = cli.run(project=project, args=[ 'show', 'target.bst' ]) @@ -44,7 +44,7 @@ def test_non_regular_file_or_directory(cli, tmpdir, datafiles): @pytest.mark.datafiles(os.path.join(DATA_DIR, 'basic')) -def test_invalid_absolute_path(cli, tmpdir, datafiles): +def test_invalid_absolute_path(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) with open(os.path.join(project, "target.bst"), 'r') as f: @@ -62,7 +62,7 @@ def test_invalid_absolute_path(cli, tmpdir, datafiles): @pytest.mark.datafiles(os.path.join(DATA_DIR, 'invalid-relative-path')) -def test_invalid_relative_path(cli, tmpdir, datafiles): +def test_invalid_relative_path(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) result = cli.run(project=project, args=['show', 'target.bst']) @@ -128,9 +128,8 @@ def test_stage_symlink(cli, tmpdir, datafiles): @pytest.mark.datafiles(os.path.join(DATA_DIR, 'file-exists')) -def test_stage_file_exists(cli, tmpdir, datafiles): +def test_stage_file_exists(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) - checkoutdir = os.path.join(str(tmpdir), "checkout") # Build, checkout result = cli.run(project=project, args=['build', 'target.bst']) diff --git a/tests/sources/ostree.py b/tests/sources/ostree.py index 7ddea77f6..e2d6b6a0f 100644 --- a/tests/sources/ostree.py +++ b/tests/sources/ostree.py @@ -38,7 +38,7 @@ def test_submodule_track_no_ref_or_track(cli, tmpdir, datafiles): # Create the repo from 'repofiles' subdir repo = create_repo('ostree', str(tmpdir)) - ref = repo.create(os.path.join(project, 'repofiles')) + repo.create(os.path.join(project, 'repofiles')) # Write out our test target ostreesource = repo.source_config(ref=None) diff --git a/tests/sources/patch.py b/tests/sources/patch.py index 2a82bf184..761656580 100644 --- a/tests/sources/patch.py +++ b/tests/sources/patch.py @@ -12,7 +12,7 @@ DATA_DIR = os.path.join( @pytest.mark.datafiles(os.path.join(DATA_DIR, 'basic')) -def test_missing_patch(cli, tmpdir, datafiles): +def test_missing_patch(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) # Removing the local file causes preflight to fail @@ -26,11 +26,11 @@ def test_missing_patch(cli, tmpdir, datafiles): @pytest.mark.datafiles(os.path.join(DATA_DIR, 'basic')) -def test_non_regular_file_patch(cli, tmpdir, datafiles): +def test_non_regular_file_patch(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) patch_path = os.path.join(project, 'irregular_file.patch') - for file_type in filetypegenerator.generate_file_types(patch_path): + for _file_type in filetypegenerator.generate_file_types(patch_path): result = cli.run(project=project, args=[ 'show', 'irregular.bst' ]) @@ -42,7 +42,7 @@ def test_non_regular_file_patch(cli, tmpdir, datafiles): @pytest.mark.datafiles(os.path.join(DATA_DIR, 'basic')) -def test_invalid_absolute_path(cli, tmpdir, datafiles): +def test_invalid_absolute_path(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) with open(os.path.join(project, "target.bst"), 'r') as f: @@ -60,7 +60,7 @@ def test_invalid_absolute_path(cli, tmpdir, datafiles): @pytest.mark.datafiles(os.path.join(DATA_DIR, 'invalid-relative-path')) -def test_invalid_relative_path(cli, tmpdir, datafiles): +def test_invalid_relative_path(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) result = cli.run(project=project, args=['show', 'irregular.bst']) @@ -85,9 +85,8 @@ def test_stage_and_patch(cli, tmpdir, datafiles): @pytest.mark.datafiles(os.path.join(DATA_DIR, 'basic')) -def test_stage_file_nonexistent_dir(cli, tmpdir, datafiles): +def test_stage_file_nonexistent_dir(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) - checkoutdir = os.path.join(str(tmpdir), "checkout") # 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']) @@ -96,9 +95,8 @@ def test_stage_file_nonexistent_dir(cli, tmpdir, datafiles): @pytest.mark.datafiles(os.path.join(DATA_DIR, 'basic')) -def test_stage_file_empty_dir(cli, tmpdir, datafiles): +def test_stage_file_empty_dir(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) - checkoutdir = os.path.join(str(tmpdir), "checkout") # Fails at build time because it tries to patch with nothing else staged result = cli.run(project=project, args=['build', 'failure-empty-dir.bst']) diff --git a/tests/sources/pip.py b/tests/sources/pip.py index 3114a824e..7ff547b14 100644 --- a/tests/sources/pip.py +++ b/tests/sources/pip.py @@ -12,24 +12,24 @@ DATA_DIR = os.path.join( ) -def generate_project(project_dir, tmpdir): +def generate_project(project_dir): project_file = os.path.join(project_dir, "project.conf") _yaml.dump({'name': 'foo'}, project_file) # 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): +def test_no_ref(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) - generate_project(project, tmpdir) + generate_project(project) assert cli.get_element_state(project, 'target.bst') == 'no reference' # 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, tmpdir, datafiles): +def test_first_source(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) - generate_project(project, tmpdir) + generate_project(project) result = cli.run(project=project, args=[ 'show', 'target.bst' ]) @@ -39,9 +39,9 @@ def test_first_source(cli, tmpdir, datafiles): # Test that error is raised when neither packges nor requirements files # have been specified @pytest.mark.datafiles(os.path.join(DATA_DIR, 'no-packages')) -def test_no_packages(cli, tmpdir, datafiles): +def test_no_packages(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) - generate_project(project, tmpdir) + 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 9d831781a..efea86339 100644 --- a/tests/sources/previous_source_access.py +++ b/tests/sources/previous_source_access.py @@ -14,7 +14,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, tmpdir, datafiles): +def test_custom_transform_source(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) # Ensure we can track @@ -30,7 +30,7 @@ def test_custom_transform_source(cli, tmpdir, datafiles): result.assert_success() # Ensure we get correct output from foo_transform - result = cli.run(project=project, args=[ + cli.run(project=project, args=[ 'build', 'target.bst' ]) destpath = os.path.join(cli.directory, 'checkout') diff --git a/tests/sources/remote.py b/tests/sources/remote.py index 30b65b4cc..5ca2f79d2 100644 --- a/tests/sources/remote.py +++ b/tests/sources/remote.py @@ -144,7 +144,7 @@ def test_unique_key(cli, tmpdir, datafiles): assert states['target-custom-executable.bst'] == "fetch needed" # Try to fetch it - result = cli.run(project=project, args=[ + cli.run(project=project, args=[ 'source', 'fetch', 'target.bst' ]) @@ -171,11 +171,11 @@ def test_executable(cli, tmpdir, datafiles): checkoutdir = os.path.join(str(tmpdir), "checkout") assert cli.get_element_state(project, 'target-custom-executable.bst') == "fetch needed" # Try to fetch it - result = cli.run(project=project, args=[ + cli.run(project=project, args=[ 'build', 'target-custom-executable.bst' ]) - result = cli.run(project=project, args=[ + cli.run(project=project, args=[ 'artifact', 'checkout', 'target-custom-executable.bst', '--directory', checkoutdir ]) mode = os.stat(os.path.join(checkoutdir, 'some-custom-file')).st_mode diff --git a/tests/sources/tar.py b/tests/sources/tar.py index 9284a25a3..11f288b9a 100644 --- a/tests/sources/tar.py +++ b/tests/sources/tar.py @@ -307,7 +307,7 @@ def test_read_only_dir(cli, tmpdir, datafiles): finally: # Make tmpdir deletable no matter what happens - def make_dir_writable(fn, path, excinfo): + def make_dir_writable(_fn, path, _excinfo): os.chmod(os.path.dirname(path), 0o777) if os.path.isdir(path): os.rmdir(path) @@ -365,7 +365,6 @@ def test_netrc_already_specified_user(cli, datafiles, server_type, tmpdir): os.makedirs(file_server_files, exist_ok=True) os.makedirs(fake_home, exist_ok=True) project = str(datafiles) - checkoutdir = os.path.join(str(tmpdir), 'checkout') os.environ['HOME'] = fake_home with open(os.path.join(fake_home, '.netrc'), 'wb') as f: diff --git a/tests/testutils/artifactshare.py b/tests/testutils/artifactshare.py index 8abc0fa2c..41673ca1d 100644 --- a/tests/testutils/artifactshare.py +++ b/tests/testutils/artifactshare.py @@ -1,6 +1,4 @@ import string -import pytest -import subprocess import os import shutil import signal @@ -10,7 +8,6 @@ from contextlib import contextmanager from multiprocessing import Process, Queue import pytest_cov -from buildstream import _yaml from buildstream._cas import CASCache from buildstream._cas.casserver import create_server from buildstream._exceptions import CASError @@ -91,7 +88,7 @@ class ArtifactShare(): # Send port to parent q.put(port) - except Exception as e: + except Exception: q.put(None) raise @@ -168,7 +165,7 @@ class ArtifactShare(): shutil.rmtree(self.directory) - def _mock_statvfs(self, path): + def _mock_statvfs(self, _path): repo_size = 0 for root, _, files in os.walk(self.repodir): for filename in files: diff --git a/tests/testutils/filetypegenerator.py b/tests/testutils/filetypegenerator.py index 622f454a1..8b7d818d8 100644 --- a/tests/testutils/filetypegenerator.py +++ b/tests/testutils/filetypegenerator.py @@ -39,7 +39,7 @@ def generate_file_types(path): clean() - with open(path, 'w') as f: + with open(path, 'w'): pass yield clean() diff --git a/tests/testutils/junction.py b/tests/testutils/junction.py index efc429ef6..01c76d14a 100644 --- a/tests/testutils/junction.py +++ b/tests/testutils/junction.py @@ -1,4 +1,3 @@ -import os from tests.testutils import create_repo from buildstream import _yaml diff --git a/tests/testutils/repo/__init__.py b/tests/testutils/repo/__init__.py index ff6844cf1..1881aa3c4 100644 --- a/tests/testutils/repo/__init__.py +++ b/tests/testutils/repo/__init__.py @@ -1,6 +1,4 @@ from collections import OrderedDict -import pytest -from ..site import HAVE_OSTREE from .git import Git from .bzr import Bzr diff --git a/tests/testutils/setuptools.py b/tests/testutils/setuptools.py index 5bf4d2532..39f4314f2 100644 --- a/tests/testutils/setuptools.py +++ b/tests/testutils/setuptools.py @@ -9,7 +9,7 @@ class MockDist(): self.datafiles = datafiles self.module_name = module_name - def get_resource_filename(self, *args, **kwargs): + def get_resource_filename(self, *_args, **_kwargs): return os.path.join(self.datafiles.dirname, self.datafiles.basename, self.module_name) |