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 8252a2bfa6670c4d3f0506b27535921dde7db217
Author: Tristan van Berkom <[email protected]>
AuthorDate: Tue Mar 29 16:41:35 2022 +0900

    tests/frontend/track.py: port tests to use internal git source
    
    In order to remove the `git` plugin, we're porting some of our test cases
    which we need to keep to use the private `git` plugin added to the test
    sample-plugins package.
---
 tests/frontend/project/project.conf                |  6 ++++
 .../track-cross-junction/subproject/project.conf   |  6 ++++
 tests/frontend/track-optional-inline/project.conf  |  6 ++++
 .../track-optional-project-refs/project.conf       |  6 ++++
 tests/frontend/track.py                            | 32 ++++++++++++++++++----
 5 files changed, 50 insertions(+), 6 deletions(-)

diff --git a/tests/frontend/project/project.conf 
b/tests/frontend/project/project.conf
index 5ba3168..7e690f5 100644
--- a/tests/frontend/project/project.conf
+++ b/tests/frontend/project/project.conf
@@ -2,3 +2,9 @@
 name: test
 min-version: 2.0
 element-path: elements
+
+plugins:
+- origin: pip
+  package-name: sample-plugins
+  sources:
+  - git
diff --git a/tests/frontend/track-cross-junction/subproject/project.conf 
b/tests/frontend/track-cross-junction/subproject/project.conf
index 39a53e2..d0163cb 100644
--- a/tests/frontend/track-cross-junction/subproject/project.conf
+++ b/tests/frontend/track-cross-junction/subproject/project.conf
@@ -1,2 +1,8 @@
 name: subtest
 min-version: 2.0
+
+plugins:
+- origin: pip
+  package-name: sample-plugins
+  sources:
+  - git
diff --git a/tests/frontend/track-optional-inline/project.conf 
b/tests/frontend/track-optional-inline/project.conf
index 47a2552..5a77b96 100644
--- a/tests/frontend/track-optional-inline/project.conf
+++ b/tests/frontend/track-optional-inline/project.conf
@@ -5,3 +5,9 @@ options:
     type: bool
     description: Test boolean
     default: False
+
+plugins:
+- origin: pip
+  package-name: sample-plugins
+  sources:
+  - git
diff --git a/tests/frontend/track-optional-project-refs/project.conf 
b/tests/frontend/track-optional-project-refs/project.conf
index 3cb9bdc..26ff42d 100644
--- a/tests/frontend/track-optional-project-refs/project.conf
+++ b/tests/frontend/track-optional-project-refs/project.conf
@@ -8,3 +8,9 @@ options:
     type: bool
     description: Test boolean
     default: False
+
+plugins:
+- origin: pip
+  package-name: sample-plugins
+  sources:
+  - git
diff --git a/tests/frontend/track.py b/tests/frontend/track.py
index c870816..61bee73 100644
--- a/tests/frontend/track.py
+++ b/tests/frontend/track.py
@@ -12,6 +12,9 @@ from buildstream._testing._utils.site import 
have_subsecond_mtime
 from buildstream.exceptions import ErrorDomain, LoadErrorReason
 from buildstream import _yaml
 from tests.testutils import generate_junction
+from tests.testutils.repo.git import Git
+from tests.testutils.site import pip_sample_packages  # pylint: 
disable=unused-import
+from tests.testutils.site import SAMPLE_PACKAGES_SKIP_REASON
 from . import configure_project
 
 # Project directory
@@ -28,6 +31,7 @@ def generate_element(repo, element_path, dep_name=None):
 
 
 @pytest.mark.datafiles(DATA_DIR)
[email protected]("not pip_sample_packages()", 
reason=SAMPLE_PACKAGES_SKIP_REASON)
 def test_track_single(cli, tmpdir, datafiles):
     project = str(datafiles)
     dev_files_path = os.path.join(project, "files", "dev-files")
@@ -38,7 +42,7 @@ def test_track_single(cli, tmpdir, datafiles):
     # Create our repo object of the given source type with
     # the dev files, and then collect the initial ref.
     #
-    repo = create_repo("git", str(tmpdir))
+    repo = Git(str(tmpdir))
     repo.create(dev_files_path)
 
     # Write out our test targets
@@ -70,6 +74,7 @@ def test_track_single(cli, tmpdir, datafiles):
 
 @pytest.mark.datafiles(os.path.join(TOP_DIR))
 @pytest.mark.parametrize("ref_storage", [("inline"), ("project-refs")])
[email protected]("not pip_sample_packages()", 
reason=SAMPLE_PACKAGES_SKIP_REASON)
 def test_track_optional(cli, tmpdir, datafiles, ref_storage):
     project = os.path.join(datafiles.dirname, datafiles.basename, 
"track-optional-" + ref_storage)
     dev_files_path = os.path.join(project, "files")
@@ -78,7 +83,7 @@ def test_track_optional(cli, tmpdir, datafiles, ref_storage):
     # Create our repo object of the given source type with
     # the dev files, and then collect the initial ref.
     #
-    repo = create_repo("git", str(tmpdir))
+    repo = Git(str(tmpdir))
     repo.create(dev_files_path)
 
     # Now create an optional test branch and add a commit to that,
@@ -166,6 +171,7 @@ def test_track_deps(cli, datafiles, deps, expected_states):
 @pytest.mark.datafiles(os.path.join(TOP_DIR, "track-cross-junction"))
 @pytest.mark.parametrize("cross_junction", [("cross"), ("nocross")])
 @pytest.mark.parametrize("ref_storage", [("inline"), ("project.refs")])
[email protected]("not pip_sample_packages()", 
reason=SAMPLE_PACKAGES_SKIP_REASON)
 def test_track_cross_junction(cli, tmpdir, datafiles, cross_junction, 
ref_storage):
     project = str(datafiles)
     dev_files_path = os.path.join(project, "files")
@@ -175,7 +181,7 @@ def test_track_cross_junction(cli, tmpdir, datafiles, 
cross_junction, ref_storag
     # Create our repo object of the given source type with
     # the dev files, and then collect the initial ref.
     #
-    repo = create_repo("git", str(tmpdir))
+    repo = Git(str(tmpdir))
     repo.create(dev_files_path)
 
     # Generate two elements using the git source, one in
@@ -185,7 +191,19 @@ def test_track_cross_junction(cli, tmpdir, datafiles, 
cross_junction, ref_storag
 
     # Generate project.conf
     #
-    project_conf = {"name": "test", "min-version": "2.0", "ref-storage": 
ref_storage}
+    project_conf = {
+        "name": "test",
+        "min-version": "2.0",
+        "ref-storage": ref_storage,
+        "plugins": [
+            {
+                "origin": "pip",
+                "package-name": "sample-plugins",
+                "sources": ["git"],
+            }
+        ],
+    }
+
     _yaml.roundtrip_dump(project_conf, os.path.join(project, "project.conf"))
 
     #
@@ -333,6 +351,7 @@ def test_junction_element(cli, tmpdir, datafiles, 
ref_storage):
 
 
 @pytest.mark.datafiles(DATA_DIR)
[email protected]("not pip_sample_packages()", 
reason=SAMPLE_PACKAGES_SKIP_REASON)
 def test_track_error_cannot_write_file(cli, tmpdir, datafiles):
     if os.geteuid() == 0:
         pytest.skip("This is not testable with root permissions")
@@ -344,7 +363,7 @@ def test_track_error_cannot_write_file(cli, tmpdir, 
datafiles):
 
     configure_project(project, {"ref-storage": "inline"})
 
-    repo = create_repo("git", str(tmpdir))
+    repo = Git(str(tmpdir))
     repo.create(dev_files_path)
 
     element_full_path = os.path.join(element_path, element_name)
@@ -363,6 +382,7 @@ def test_track_error_cannot_write_file(cli, tmpdir, 
datafiles):
 
 
 @pytest.mark.datafiles(DATA_DIR)
[email protected]("not pip_sample_packages()", 
reason=SAMPLE_PACKAGES_SKIP_REASON)
 def test_no_needless_overwrite(cli, tmpdir, datafiles):
     project = os.path.join(datafiles.dirname, datafiles.basename)
     dev_files_path = os.path.join(project, "files", "dev-files")
@@ -377,7 +397,7 @@ def test_no_needless_overwrite(cli, tmpdir, datafiles):
     # Create our repo object of the given source type with
     # the dev files, and then collect the initial ref.
     #
-    repo = create_repo("git", str(tmpdir))
+    repo = Git(str(tmpdir))
     repo.create(dev_files_path)
 
     # Write out our test target and assert it exists

Reply via email to