diff options
author | Angelos Evripiotis <jevripiotis@bloomberg.net> | 2019-03-20 11:06:42 +0000 |
---|---|---|
committer | bst-marge-bot <marge-bot@buildstream.build> | 2019-03-21 14:57:31 +0000 |
commit | f2b15d86debd32241228f7b728016ed0057cd0d2 (patch) | |
tree | e98e085e4f0a9020725aa3a25df7809a96d807ba /tests/frontend/workspace.py | |
parent | bc1b971e169f2fc721c61276c071640caee6a3f8 (diff) | |
download | buildstream-f2b15d86debd32241228f7b728016ed0057cd0d2.tar.gz |
tests: str(datafiles) instead of a longer thing
Replace some popular copypasta.
This important-looking invocation:
os.path.join(datafiles.dirname, datafiles.basename)
is equivalent to this shorter invocation:
project = str(datafiles)
It seems like it's very popular copypasta, replace it with the shorter
one thus:
# Use 'gsed' or 'sed' etc. as appropriate for your system.
git config --global alias.sub '!f() { git grep --name-only --null "$1" | gxargs --null gsed --in-place --expression "s/$1/$2/g" ; }; f'
git sub 'os.path.join(datafiles.dirname, datafiles.basename)' 'str(datafiles)'
Diffstat (limited to 'tests/frontend/workspace.py')
-rw-r--r-- | tests/frontend/workspace.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/tests/frontend/workspace.py b/tests/frontend/workspace.py index e570c2899..204cfb7a8 100644 --- a/tests/frontend/workspace.py +++ b/tests/frontend/workspace.py @@ -58,9 +58,9 @@ class WorkspaceCreator(): self.datafiles = datafiles if not project_path: - project_path = os.path.join(datafiles.dirname, datafiles.basename) + project_path = str(datafiles) else: - shutil.copytree(os.path.join(datafiles.dirname, datafiles.basename), project_path) + shutil.copytree(str(datafiles), project_path) self.project_path = project_path self.bin_files_path = os.path.join(project_path, 'files', 'bin-files') @@ -672,7 +672,7 @@ def test_build(cli, tmpdir_factory, datafiles, kind, strict, from_workspace, gue @pytest.mark.datafiles(DATA_DIR) def test_buildable_no_ref(cli, tmpdir, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) element_name = 'workspace-test-no-ref.bst' element_path = os.path.join(project, 'elements') @@ -801,7 +801,7 @@ def test_detect_modifications(cli, tmpdir, datafiles, modification, strict): {"format-version": BST_WORKSPACE_FORMAT_VERSION + 1} ]) def test_list_unsupported_workspace(cli, datafiles, workspace_cfg): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) os.makedirs(os.path.join(project, '.bst')) workspace_config_path = os.path.join(project, '.bst', 'workspaces.yml') @@ -913,7 +913,7 @@ def test_list_supported_workspace(cli, tmpdir, datafiles, workspace_cfg, expecte _yaml.dump(node, tempfile) return _yaml.node_sanitize(_yaml.load(tempfile)) - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) os.makedirs(os.path.join(project, '.bst')) workspace_config_path = os.path.join(project, '.bst', 'workspaces.yml') |