From ab18ab8d9492bb8d9ad9a6d0123f42ab131d106d Mon Sep 17 00:00:00 2001 From: Angelos Evripiotis Date: Wed, 20 Mar 2019 11:06:42 +0000 Subject: 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)' --- tests/integration/symlinks.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tests/integration/symlinks.py') diff --git a/tests/integration/symlinks.py b/tests/integration/symlinks.py index 1c2f3c2a7..5752281de 100644 --- a/tests/integration/symlinks.py +++ b/tests/integration/symlinks.py @@ -17,7 +17,7 @@ DATA_DIR = os.path.join( @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') def test_absolute_symlinks(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) checkout = os.path.join(cli.directory, 'checkout') element_name = 'symlinks/dangling-symlink.bst' @@ -38,7 +38,7 @@ def test_absolute_symlinks(cli, datafiles): @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') def test_disallow_overlaps_inside_symlink_with_dangling_target(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) checkout = os.path.join(cli.directory, 'checkout') element_name = 'symlinks/dangling-symlink-overlap.bst' @@ -53,7 +53,7 @@ def test_disallow_overlaps_inside_symlink_with_dangling_target(cli, datafiles): @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') def test_detect_symlink_overlaps_pointing_outside_sandbox(cli, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) checkout = os.path.join(cli.directory, 'checkout') element_name = 'symlinks/symlink-to-outside-sandbox-overlap.bst' -- cgit v1.2.1