This is an automated email from the ASF dual-hosted git repository. tvb pushed a commit to branch tristan/remove-plugins in repository https://gitbox.apache.org/repos/asf/buildstream.git
commit 76cf305da7b174e9ee5dbd32a407a6e6309c53d6 Author: Tristan van Berkom <[email protected]> AuthorDate: Mon Mar 28 16:59:03 2022 +0900 tests/sources/patch.py: Removing patch source tests --- tests/sources/patch.py | 147 --------------------- tests/sources/patch/basic/failure-empty-dir.bst | 5 - .../patch/basic/failure-nonexistent-dir.bst | 6 - tests/sources/patch/basic/file.txt | 1 - tests/sources/patch/basic/file_1.patch | 7 - tests/sources/patch/basic/irregular.bst | 7 - tests/sources/patch/basic/project.conf | 3 - tests/sources/patch/basic/target.bst | 7 - tests/sources/patch/different-strip-level/file.txt | 1 - .../patch/different-strip-level/file_1.patch | 7 - .../patch/different-strip-level/project.conf | 3 - .../sources/patch/different-strip-level/target.bst | 8 -- .../patch/invalid-relative-path/file_1.patch | 7 - .../patch/invalid-relative-path/irregular.bst | 5 - .../patch/invalid-relative-path/project.conf | 3 - tests/sources/patch/multiple-patches/file.txt | 1 - tests/sources/patch/multiple-patches/file_1.patch | 7 - tests/sources/patch/multiple-patches/file_2.patch | 7 - tests/sources/patch/multiple-patches/project.conf | 3 - tests/sources/patch/multiple-patches/target.bst | 9 -- .../sources/patch/separate-patch-dir/file_1.patch | 7 - .../separate-patch-dir/files/test-dir/file.txt | 1 - .../sources/patch/separate-patch-dir/project.conf | 3 - tests/sources/patch/separate-patch-dir/target.bst | 8 -- 24 files changed, 263 deletions(-) diff --git a/tests/sources/patch.py b/tests/sources/patch.py deleted file mode 100644 index c34f5b3..0000000 --- a/tests/sources/patch.py +++ /dev/null @@ -1,147 +0,0 @@ -# Pylint doesn't play well with fixtures and dependency injection from pytest -# pylint: disable=redefined-outer-name - -import os -import pytest - -from buildstream.exceptions import ErrorDomain, LoadErrorReason -from buildstream._testing import cli # pylint: disable=unused-import -from tests.testutils import filetypegenerator - -DATA_DIR = os.path.join( - os.path.dirname(os.path.realpath(__file__)), - "patch", -) - - [email protected](os.path.join(DATA_DIR, "basic")) -def test_missing_patch(cli, datafiles): - project = str(datafiles) - - # Removing the local file causes preflight to fail - localfile = os.path.join(project, "file_1.patch") - os.remove(localfile) - - result = cli.run(project=project, args=["show", "target.bst"]) - result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.MISSING_FILE) - - [email protected](os.path.join(DATA_DIR, "basic")) -def test_non_regular_file_patch(cli, datafiles): - project = str(datafiles) - - patch_path = os.path.join(project, "irregular_file.patch") - for _file_type in filetypegenerator.generate_file_types(patch_path): - result = cli.run(project=project, args=["show", "irregular.bst"]) - if os.path.isfile(patch_path) and not os.path.islink(patch_path): - result.assert_success() - else: - result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.PROJ_PATH_INVALID_KIND) - - [email protected](os.path.join(DATA_DIR, "basic")) -def test_invalid_absolute_path(cli, datafiles): - project = str(datafiles) - - with open(os.path.join(project, "target.bst"), "r", encoding="utf-8") as f: - old_yaml = f.read() - new_yaml = old_yaml.replace("file_1.patch", os.path.join(project, "file_1.patch")) - assert old_yaml != new_yaml - - with open(os.path.join(project, "target.bst"), "w", encoding="utf-8") as f: - f.write(new_yaml) - - result = cli.run(project=project, args=["show", "target.bst"]) - result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.PROJ_PATH_INVALID) - - [email protected](os.path.join(DATA_DIR, "invalid-relative-path")) -def test_invalid_relative_path(cli, datafiles): - project = str(datafiles) - - result = cli.run(project=project, args=["show", "irregular.bst"]) - result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.PROJ_PATH_INVALID) - - [email protected](os.path.join(DATA_DIR, "basic")) -def test_stage_and_patch(cli, tmpdir, datafiles): - project = str(datafiles) - checkoutdir = os.path.join(str(tmpdir), "checkout") - - # Build, checkout - result = cli.run(project=project, args=["build", "target.bst"]) - result.assert_success() - result = cli.run(project=project, args=["artifact", "checkout", "target.bst", "--directory", checkoutdir]) - result.assert_success() - - # Test the file.txt was patched and changed - with open(os.path.join(checkoutdir, "file.txt"), encoding="utf-8") as f: - assert f.read() == "This is text file with superpowers\n" - - [email protected](os.path.join(DATA_DIR, "basic")) -def test_stage_file_nonexistent_dir(cli, datafiles): - project = str(datafiles) - - # 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"]) - result.assert_main_error(ErrorDomain.STREAM, None) - result.assert_task_error(ErrorDomain.SOURCE, "patch-no-files") - - [email protected](os.path.join(DATA_DIR, "basic")) -def test_stage_file_empty_dir(cli, datafiles): - project = str(datafiles) - - # Fails at build time because it tries to patch with nothing else staged - result = cli.run(project=project, args=["build", "failure-empty-dir.bst"]) - result.assert_main_error(ErrorDomain.STREAM, None) - result.assert_task_error(ErrorDomain.SOURCE, "patch-no-files") - - [email protected](os.path.join(DATA_DIR, "separate-patch-dir")) -def test_stage_separate_patch_dir(cli, tmpdir, datafiles): - project = str(datafiles) - checkoutdir = os.path.join(str(tmpdir), "checkout") - - # Track, fetch, build, checkout - result = cli.run(project=project, args=["build", "target.bst"]) - result.assert_success() - result = cli.run(project=project, args=["artifact", "checkout", "target.bst", "--directory", checkoutdir]) - result.assert_success() - - # Test the file.txt was patched and changed - with open(os.path.join(checkoutdir, "test-dir", "file.txt"), encoding="utf-8") as f: - assert f.read() == "This is text file in a directory with superpowers\n" - - [email protected](os.path.join(DATA_DIR, "multiple-patches")) -def test_stage_multiple_patches(cli, tmpdir, datafiles): - project = str(datafiles) - checkoutdir = os.path.join(str(tmpdir), "checkout") - - # Track, fetch, build, checkout - result = cli.run(project=project, args=["build", "target.bst"]) - result.assert_success() - result = cli.run(project=project, args=["artifact", "checkout", "target.bst", "--directory", checkoutdir]) - result.assert_success() - - # Test the file.txt was patched and changed - with open(os.path.join(checkoutdir, "file.txt"), encoding="utf-8") as f: - assert f.read() == "This is text file with more superpowers\n" - - [email protected](os.path.join(DATA_DIR, "different-strip-level")) -def test_patch_strip_level(cli, tmpdir, datafiles): - project = str(datafiles) - checkoutdir = os.path.join(str(tmpdir), "checkout") - - # Track, fetch, build, checkout - result = cli.run(project=project, args=["build", "target.bst"]) - result.assert_success() - result = cli.run(project=project, args=["artifact", "checkout", "target.bst", "--directory", checkoutdir]) - result.assert_success() - - # Test the file.txt was patched and changed - with open(os.path.join(checkoutdir, "file.txt"), encoding="utf-8") as f: - assert f.read() == "This is text file with superpowers\n" diff --git a/tests/sources/patch/basic/failure-empty-dir.bst b/tests/sources/patch/basic/failure-empty-dir.bst deleted file mode 100644 index b22af27..0000000 --- a/tests/sources/patch/basic/failure-empty-dir.bst +++ /dev/null @@ -1,5 +0,0 @@ -kind: import -description: This is also the pony -sources: -- kind: patch - path: file_1.patch diff --git a/tests/sources/patch/basic/failure-nonexistent-dir.bst b/tests/sources/patch/basic/failure-nonexistent-dir.bst deleted file mode 100644 index 8fd593d..0000000 --- a/tests/sources/patch/basic/failure-nonexistent-dir.bst +++ /dev/null @@ -1,6 +0,0 @@ -kind: import -description: This is also the pony -sources: -- kind: patch - path: file_1.patch - directory: /idontexist diff --git a/tests/sources/patch/basic/file.txt b/tests/sources/patch/basic/file.txt deleted file mode 100644 index a496efe..0000000 --- a/tests/sources/patch/basic/file.txt +++ /dev/null @@ -1 +0,0 @@ -This is a text file diff --git a/tests/sources/patch/basic/file_1.patch b/tests/sources/patch/basic/file_1.patch deleted file mode 100644 index 424a486..0000000 --- a/tests/sources/patch/basic/file_1.patch +++ /dev/null @@ -1,7 +0,0 @@ -diff --git a/file.txt b/file.txt -index a496efe..341ef26 100644 ---- a/file.txt -+++ b/file.txt -@@ -1 +1 @@ --This is a text file -+This is text file with superpowers diff --git a/tests/sources/patch/basic/irregular.bst b/tests/sources/patch/basic/irregular.bst deleted file mode 100644 index 425cbcc..0000000 --- a/tests/sources/patch/basic/irregular.bst +++ /dev/null @@ -1,7 +0,0 @@ -kind: import -description: This is the pony -sources: -- kind: local - path: file.txt -- kind: patch - path: irregular_file.patch diff --git a/tests/sources/patch/basic/project.conf b/tests/sources/patch/basic/project.conf deleted file mode 100644 index dc34380..0000000 --- a/tests/sources/patch/basic/project.conf +++ /dev/null @@ -1,3 +0,0 @@ -# Basic project -name: foo -min-version: 2.0 diff --git a/tests/sources/patch/basic/target.bst b/tests/sources/patch/basic/target.bst deleted file mode 100644 index 913371d..0000000 --- a/tests/sources/patch/basic/target.bst +++ /dev/null @@ -1,7 +0,0 @@ -kind: import -description: This is the pony -sources: -- kind: local - path: file.txt -- kind: patch - path: file_1.patch diff --git a/tests/sources/patch/different-strip-level/file.txt b/tests/sources/patch/different-strip-level/file.txt deleted file mode 100644 index a496efe..0000000 --- a/tests/sources/patch/different-strip-level/file.txt +++ /dev/null @@ -1 +0,0 @@ -This is a text file diff --git a/tests/sources/patch/different-strip-level/file_1.patch b/tests/sources/patch/different-strip-level/file_1.patch deleted file mode 100644 index ff7f7fe..0000000 --- a/tests/sources/patch/different-strip-level/file_1.patch +++ /dev/null @@ -1,7 +0,0 @@ -diff --git foo/a/file.txt foo/b/file.txt -index a496efe..341ef26 100644 ---- foo/a/file.txt -+++ foo/b/file.txt -@@ -1 +1 @@ --This is a text file -+This is text file with superpowers diff --git a/tests/sources/patch/different-strip-level/project.conf b/tests/sources/patch/different-strip-level/project.conf deleted file mode 100644 index dc34380..0000000 --- a/tests/sources/patch/different-strip-level/project.conf +++ /dev/null @@ -1,3 +0,0 @@ -# Basic project -name: foo -min-version: 2.0 diff --git a/tests/sources/patch/different-strip-level/target.bst b/tests/sources/patch/different-strip-level/target.bst deleted file mode 100644 index c8ea19a..0000000 --- a/tests/sources/patch/different-strip-level/target.bst +++ /dev/null @@ -1,8 +0,0 @@ -kind: import -description: This is the pony -sources: -- kind: local - path: file.txt -- kind: patch - path: file_1.patch - strip-level: 2 diff --git a/tests/sources/patch/invalid-relative-path/file_1.patch b/tests/sources/patch/invalid-relative-path/file_1.patch deleted file mode 100644 index 424a486..0000000 --- a/tests/sources/patch/invalid-relative-path/file_1.patch +++ /dev/null @@ -1,7 +0,0 @@ -diff --git a/file.txt b/file.txt -index a496efe..341ef26 100644 ---- a/file.txt -+++ b/file.txt -@@ -1 +1 @@ --This is a text file -+This is text file with superpowers diff --git a/tests/sources/patch/invalid-relative-path/irregular.bst b/tests/sources/patch/invalid-relative-path/irregular.bst deleted file mode 100644 index 6b63a4e..0000000 --- a/tests/sources/patch/invalid-relative-path/irregular.bst +++ /dev/null @@ -1,5 +0,0 @@ -kind: import -description: This is the pony -sources: -- kind: patch - path: ../invalid-relative-path/irregular_file.patch diff --git a/tests/sources/patch/invalid-relative-path/project.conf b/tests/sources/patch/invalid-relative-path/project.conf deleted file mode 100644 index dc34380..0000000 --- a/tests/sources/patch/invalid-relative-path/project.conf +++ /dev/null @@ -1,3 +0,0 @@ -# Basic project -name: foo -min-version: 2.0 diff --git a/tests/sources/patch/multiple-patches/file.txt b/tests/sources/patch/multiple-patches/file.txt deleted file mode 100644 index a496efe..0000000 --- a/tests/sources/patch/multiple-patches/file.txt +++ /dev/null @@ -1 +0,0 @@ -This is a text file diff --git a/tests/sources/patch/multiple-patches/file_1.patch b/tests/sources/patch/multiple-patches/file_1.patch deleted file mode 100644 index 424a486..0000000 --- a/tests/sources/patch/multiple-patches/file_1.patch +++ /dev/null @@ -1,7 +0,0 @@ -diff --git a/file.txt b/file.txt -index a496efe..341ef26 100644 ---- a/file.txt -+++ b/file.txt -@@ -1 +1 @@ --This is a text file -+This is text file with superpowers diff --git a/tests/sources/patch/multiple-patches/file_2.patch b/tests/sources/patch/multiple-patches/file_2.patch deleted file mode 100644 index f56614b..0000000 --- a/tests/sources/patch/multiple-patches/file_2.patch +++ /dev/null @@ -1,7 +0,0 @@ -diff --git a/file.txt b/file.txt -index a496efe..341ef26 100644 ---- a/file.txt -+++ b/file.txt -@@ -1 +1 @@ --This is text file with superpowers -+This is text file with more superpowers diff --git a/tests/sources/patch/multiple-patches/project.conf b/tests/sources/patch/multiple-patches/project.conf deleted file mode 100644 index dc34380..0000000 --- a/tests/sources/patch/multiple-patches/project.conf +++ /dev/null @@ -1,3 +0,0 @@ -# Basic project -name: foo -min-version: 2.0 diff --git a/tests/sources/patch/multiple-patches/target.bst b/tests/sources/patch/multiple-patches/target.bst deleted file mode 100644 index 4665e7d..0000000 --- a/tests/sources/patch/multiple-patches/target.bst +++ /dev/null @@ -1,9 +0,0 @@ -kind: import -description: This is the pony -sources: -- kind: local - path: file.txt -- kind: patch - path: file_1.patch -- kind: patch - path: file_2.patch diff --git a/tests/sources/patch/separate-patch-dir/file_1.patch b/tests/sources/patch/separate-patch-dir/file_1.patch deleted file mode 100644 index ae8bc33..0000000 --- a/tests/sources/patch/separate-patch-dir/file_1.patch +++ /dev/null @@ -1,7 +0,0 @@ -diff --git a/file.txt b/file.txt -index a496efe..341ef26 100644 ---- a/file.txt -+++ b/file.txt -@@ -1 +1 @@ --This is a text file in a directory -+This is text file in a directory with superpowers diff --git a/tests/sources/patch/separate-patch-dir/files/test-dir/file.txt b/tests/sources/patch/separate-patch-dir/files/test-dir/file.txt deleted file mode 100644 index 425911a..0000000 --- a/tests/sources/patch/separate-patch-dir/files/test-dir/file.txt +++ /dev/null @@ -1 +0,0 @@ -This is a text file in a directory diff --git a/tests/sources/patch/separate-patch-dir/project.conf b/tests/sources/patch/separate-patch-dir/project.conf deleted file mode 100644 index dc34380..0000000 --- a/tests/sources/patch/separate-patch-dir/project.conf +++ /dev/null @@ -1,3 +0,0 @@ -# Basic project -name: foo -min-version: 2.0 diff --git a/tests/sources/patch/separate-patch-dir/target.bst b/tests/sources/patch/separate-patch-dir/target.bst deleted file mode 100644 index 796c131..0000000 --- a/tests/sources/patch/separate-patch-dir/target.bst +++ /dev/null @@ -1,8 +0,0 @@ -kind: import -description: This is the pony -sources: -- kind: local - path: files -- kind: patch - path: file_1.patch - directory: test-dir
