diff options
author | Benjamin Schubert <ben.c.schubert@gmail.com> | 2019-02-28 19:31:03 +0000 |
---|---|---|
committer | bst-marge-bot <marge-bot@buildstream.build> | 2019-03-01 19:05:30 +0000 |
commit | d6d33c94751bd47ca77d2b2e4ac246a2dd1328a6 (patch) | |
tree | 1739ba821e90215f89901bed10326f4142360f21 /tests | |
parent | 8f9b3dcdaca6f5179b79328b17b3e2c71db19e73 (diff) | |
download | buildstream-d6d33c94751bd47ca77d2b2e4ac246a2dd1328a6.tar.gz |
tests: Remove unused variables
Diffstat (limited to 'tests')
38 files changed, 98 insertions, 144 deletions
diff --git a/tests/artifactcache/cache_size.py b/tests/artifactcache/cache_size.py index dcfc13424..234317c72 100644 --- a/tests/artifactcache/cache_size.py +++ b/tests/artifactcache/cache_size.py @@ -60,9 +60,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..14cbd8791 100644 --- a/tests/artifactcache/expiry.py +++ b/tests/artifactcache/expiry.py @@ -42,8 +42,6 @@ DATA_DIR = os.path.join( def test_artifact_expires(cli, datafiles, tmpdir): 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': { @@ -104,7 +102,6 @@ def test_artifact_too_large(cli, datafiles, tmpdir, size): def test_expiry_order(cli, datafiles, tmpdir): 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({ @@ -162,7 +159,6 @@ def test_expiry_order(cli, datafiles, tmpdir): def test_keep_dependencies(cli, datafiles, tmpdir): project = os.path.join(datafiles.dirname, datafiles.basename) element_path = 'elements' - cache_location = os.path.join(project, 'cache', 'artifacts', 'ostree') cli.configure({ 'cache': { @@ -402,8 +398,6 @@ def test_invalid_cache_quota(cli, datafiles, tmpdir, quota, err_domain, err_reas def test_cleanup_first(cli, datafiles, tmpdir): 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/push.py b/tests/artifactcache/push.py index a7b8bdbd9..6ad7f849f 100644 --- a/tests/artifactcache/push.py +++ b/tests/artifactcache/push.py @@ -251,7 +251,6 @@ def test_push_message(cli, tmpdir, 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..2667bc6d9 100644 --- a/tests/elements/filter.py +++ b/tests/elements/filter.py @@ -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" diff --git a/tests/examples/integration-commands.py b/tests/examples/integration-commands.py index abc64d951..aabf56220 100644 --- a/tests/examples/integration-commands.py +++ b/tests/examples/integration-commands.py @@ -18,7 +18,6 @@ DATA_DIR = os.path.join( @pytest.mark.datafiles(DATA_DIR) def test_integration_commands_build(cli, tmpdir, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) - checkout = os.path.join(cli.directory, 'checkout') result = cli.run(project=project, args=['build', 'hello.bst']) assert result.exit_code == 0 diff --git a/tests/examples/running-commands.py b/tests/examples/running-commands.py index 6290204a9..1fad3e651 100644 --- a/tests/examples/running-commands.py +++ b/tests/examples/running-commands.py @@ -18,7 +18,6 @@ DATA_DIR = os.path.join( @pytest.mark.datafiles(DATA_DIR) def test_running_commands_build(cli, tmpdir, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) - checkout = os.path.join(cli.directory, 'checkout') result = cli.run(project=project, args=['build', 'hello.bst']) assert result.exit_code == 0 diff --git a/tests/format/junctions.py b/tests/format/junctions.py index 7f27b5982..699c4675f 100644 --- a/tests/format/junctions.py +++ b/tests/format/junctions.py @@ -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)) diff --git a/tests/format/project.py b/tests/format/project.py index db6604409..4a3055c08 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, diff --git a/tests/frontend/buildcheckout.py b/tests/frontend/buildcheckout.py index af34e6d67..e252282d1 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)) @@ -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..3b7f78f3b 100644 --- a/tests/frontend/completions.py +++ b/tests/frontend/completions.py @@ -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/mirror.py b/tests/frontend/mirror.py index c0c2e7059..75810ccbd 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') @@ -417,9 +414,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 +609,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 +693,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/pull.py b/tests/frontend/pull.py index 1326beccc..0c4813766 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}, diff --git a/tests/frontend/push.py b/tests/frontend/push.py index 7a4cb3c0d..107af9d8c 100644 --- a/tests/frontend/push.py +++ b/tests/frontend/push.py @@ -100,7 +100,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 +114,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 +389,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..528f114a7 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')) diff --git a/tests/frontend/track.py b/tests/frontend/track.py index 486a4123c..ba78bcdfa 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. @@ -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..7fc9f9bc9 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) diff --git a/tests/frontend/workspace.py b/tests/frontend/workspace.py index 7ca8064b8..122455bff 100644 --- a/tests/frontend/workspace.py +++ b/tests/frontend/workspace.py @@ -807,9 +807,6 @@ def test_detect_modifications(cli, tmpdir, datafiles, modification, strict): ]) def test_list_unsupported_workspace(cli, tmpdir, 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/integration/build-uid.py b/tests/integration/build-uid.py index 88b887b5e..9c2c6f06b 100644 --- a/tests/integration/build-uid.py +++ b/tests/integration/build-uid.py @@ -20,7 +20,6 @@ DATA_DIR = os.path.join( @pytest.mark.datafiles(DATA_DIR) def test_build_uid_overridden(cli, tmpdir, 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 = { @@ -39,7 +38,6 @@ def test_build_uid_overridden(cli, tmpdir, datafiles): @pytest.mark.datafiles(DATA_DIR) def test_build_uid_in_project(cli, tmpdir, 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 = { @@ -58,7 +56,6 @@ def test_build_uid_in_project(cli, tmpdir, datafiles): @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') def test_build_uid_default(cli, tmpdir, 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..2b5fbb0e1 100644 --- a/tests/integration/cachedfail.py +++ b/tests/integration/cachedfail.py @@ -24,7 +24,6 @@ DATA_DIR = os.path.join( def test_build_checkout_cached_fail(cli, tmpdir, 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 @@ -69,8 +68,6 @@ def test_build_depend_on_cached_fail(cli, tmpdir, 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', diff --git a/tests/integration/compose-symlinks.py b/tests/integration/compose-symlinks.py index 027feea7c..aa943deff 100644 --- a/tests/integration/compose-symlinks.py +++ b/tests/integration/compose-symlinks.py @@ -21,11 +21,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/manual.py b/tests/integration/manual.py index 97cbec537..f4ad6f9db 100644 --- a/tests/integration/manual.py +++ b/tests/integration/manual.py @@ -134,7 +134,6 @@ def test_manual_element_noparallel(cli, tmpdir, datafiles): @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') def test_manual_element_logging(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') element_name = 'import/import.bst' diff --git a/tests/internals/loader.py b/tests/internals/loader.py index 87a5c3b35..a9727b680 100644 --- a/tests/internals/loader.py +++ b/tests/internals/loader.py @@ -46,7 +46,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 +58,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 +70,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 +95,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 +107,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/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..32aa7891a 100644 --- a/tests/plugins/deprecationwarnings/deprecationwarnings.py +++ b/tests/plugins/deprecationwarnings/deprecationwarnings.py @@ -26,7 +26,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/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/sources/git.py b/tests/sources/git.py index 98891a9af..691ada8c2 100644 --- a/tests/sources/git.py +++ b/tests/sources/git.py @@ -47,7 +47,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 +74,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 +117,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 +156,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 +195,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 +238,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 +283,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 +324,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 +395,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 +478,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 +686,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 +736,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 +800,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 +912,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 +1093,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 +1191,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..0b0227d1c 100644 --- a/tests/sources/local.py +++ b/tests/sources/local.py @@ -30,7 +30,7 @@ def test_non_regular_file_or_directory(cli, tmpdir, 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' ]) @@ -130,7 +130,6 @@ 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): 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..825c56bcb 100644 --- a/tests/sources/patch.py +++ b/tests/sources/patch.py @@ -30,7 +30,7 @@ def test_non_regular_file_patch(cli, tmpdir, 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' ]) @@ -87,7 +87,6 @@ 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): 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']) @@ -98,7 +97,6 @@ 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): 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/previous_source_access.py b/tests/sources/previous_source_access.py index 9d831781a..68662ed58 100644 --- a/tests/sources/previous_source_access.py +++ b/tests/sources/previous_source_access.py @@ -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..e602b3838 100644 --- a/tests/sources/tar.py +++ b/tests/sources/tar.py @@ -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..a12b510aa 100644 --- a/tests/testutils/artifactshare.py +++ b/tests/testutils/artifactshare.py @@ -91,7 +91,7 @@ class ArtifactShare(): # Send port to parent q.put(port) - except Exception as e: + except Exception: q.put(None) raise 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() |