From f2b15d86debd32241228f7b728016ed0057cd0d2 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/manual.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'tests/integration/manual.py') diff --git a/tests/integration/manual.py b/tests/integration/manual.py index 507434eaa..76ea1dc66 100644 --- a/tests/integration/manual.py +++ b/tests/integration/manual.py @@ -34,7 +34,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, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) checkout = os.path.join(cli.directory, 'checkout') element_path = os.path.join(project, 'elements') element_name = 'import/import.bst' @@ -68,7 +68,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, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) checkout = os.path.join(cli.directory, 'checkout') element_path = os.path.join(project, 'elements') element_name = 'import/import.bst' @@ -98,7 +98,7 @@ def test_manual_element_environment(cli, 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, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) checkout = os.path.join(cli.directory, 'checkout') element_path = os.path.join(project, 'elements') element_name = 'import/import.bst' @@ -133,7 +133,7 @@ def test_manual_element_noparallel(cli, 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, datafiles): - project = os.path.join(datafiles.dirname, datafiles.basename) + project = str(datafiles) element_path = os.path.join(project, 'elements') element_name = 'import/import.bst' -- cgit v1.2.1