diff options
author | Angelos Evripiotis <jevripiotis@bloomberg.net> | 2019-03-20 11:06:42 +0000 |
---|---|---|
committer | Angelos Evripiotis <jevripiotis@bloomberg.net> | 2019-03-20 12:20:53 +0000 |
commit | ab18ab8d9492bb8d9ad9a6d0123f42ab131d106d (patch) | |
tree | 5f8dbe327a4dd8978b70f9bc5cbeb94dbbae8474 /tests/integration/cachedfail.py | |
parent | e1b1e6c9d552cd960e1531023ead44c9f3408b45 (diff) | |
download | buildstream-aevri/dirname_basename.tar.gz |
tests: str(datafiles) instead of a longer thingaevri/dirname_basename
Replace some popular copypasta.
This important-looking invocation:
os.path.join(datafiles.dirname, datafiles.basename)
is equivalent to this shorter invocation:
project = str(datafiles)
It seems like it's very popular copypasta, replace it with the shorter
one thus:
# Use 'gsed' or 'sed' etc. as appropriate for your system.
git config --global alias.sub '!f() { git grep --name-only --null "$1" | gxargs --null gsed --in-place --expression "s/$1/$2/g" ; }; f'
git sub 'os.path.join(datafiles.dirname, datafiles.basename)' 'str(datafiles)'
Diffstat (limited to 'tests/integration/cachedfail.py')
-rw-r--r-- | tests/integration/cachedfail.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/integration/cachedfail.py b/tests/integration/cachedfail.py index 171a21afc..34849f8bc 100644 --- a/tests/integration/cachedfail.py +++ b/tests/integration/cachedfail.py @@ -22,7 +22,7 @@ DATA_DIR = os.path.join( @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') def test_build_checkout_cached_fail(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) element_path = os.path.join(project, 'elements', 'element.bst') checkout = os.path.join(cli.directory, 'checkout') @@ -65,7 +65,7 @@ def test_build_checkout_cached_fail(cli, datafiles): @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') def test_build_depend_on_cached_fail(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) dep_path = os.path.join(project, 'elements', 'dep.bst') target_path = os.path.join(project, 'elements', 'target.bst') @@ -127,7 +127,7 @@ def test_push_cached_fail(cli, tmpdir, datafiles, on_error): if on_error == 'quit': pytest.xfail('https://gitlab.com/BuildStream/buildstream/issues/534') - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) element_path = os.path.join(project, 'elements', 'element.bst') # Write out our test target @@ -167,7 +167,7 @@ def test_push_cached_fail(cli, tmpdir, datafiles, on_error): @pytest.mark.skipif(not (IS_LINUX and HAVE_BWRAP), reason='Only available with bubblewrap on Linux') @pytest.mark.datafiles(DATA_DIR) def test_host_tools_errors_are_not_cached(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) element_path = os.path.join(project, 'elements', 'element.bst') # Write out our test target |