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 16a242e137a4dd033fa8dd14aeffea3bc8289bf4
Author: Tristan van Berkom <[email protected]>
AuthorDate: Wed Mar 30 12:55:49 2022 +0900

    tests/frontend/mirror.py: Use internal git source for these tests
---
 tests/frontend/mirror.py | 39 ++++++++++++++++++++++++++++++---------
 1 file changed, 30 insertions(+), 9 deletions(-)

diff --git a/tests/frontend/mirror.py b/tests/frontend/mirror.py
index 4de64bb..ff20f82 100644
--- a/tests/frontend/mirror.py
+++ b/tests/frontend/mirror.py
@@ -9,6 +9,10 @@ from buildstream.exceptions import ErrorDomain
 from buildstream._testing import create_repo
 from buildstream._testing import cli  # pylint: disable=unused-import
 
+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
+
 
 # Project directory
 TOP_DIR = os.path.dirname(os.path.realpath(__file__))
@@ -435,6 +439,7 @@ def test_mirror_fetch_default_cmdline_overrides_config(cli, 
tmpdir):
 
 
 @pytest.mark.datafiles(DATA_DIR)
[email protected]("not pip_sample_packages()", 
reason=SAMPLE_PACKAGES_SKIP_REASON)
 def test_mirror_git_submodule_fetch(cli, tmpdir, datafiles):
     # Test that it behaves as expected with submodules, both defined in config
     # and discovered when fetching.
@@ -444,15 +449,15 @@ def test_mirror_git_submodule_fetch(cli, tmpdir, 
datafiles):
     dev_files_path = os.path.join(str(datafiles), "files", "dev-files", "usr")
     mirror_dir = os.path.join(str(datafiles), "mirror")
 
-    defined_subrepo = create_repo("git", str(tmpdir), "defined_subrepo")
+    defined_subrepo = Git(str(tmpdir), "defined_subrepo")
     defined_subrepo.create(bin_files_path)
     defined_subrepo.copy(mirror_dir)
     defined_subrepo.add_file(foo_file)
 
-    found_subrepo = create_repo("git", str(tmpdir), "found_subrepo")
+    found_subrepo = Git(str(tmpdir), "found_subrepo")
     found_subrepo.create(dev_files_path)
 
-    main_repo = create_repo("git", str(tmpdir))
+    main_repo = Git(str(tmpdir))
     main_mirror_ref = main_repo.create(bin_files_path)
     main_repo.add_submodule("defined", "file://" + defined_subrepo.repo)
     main_repo.add_submodule("found", "file://" + found_subrepo.repo)
@@ -509,6 +514,7 @@ def test_mirror_git_submodule_fetch(cli, tmpdir, datafiles):
 
 
 @pytest.mark.datafiles(DATA_DIR)
[email protected]("not pip_sample_packages()", 
reason=SAMPLE_PACKAGES_SKIP_REASON)
 def test_mirror_fallback_git_only_submodules(cli, tmpdir, datafiles):
     # Main repo has no mirror or alias.
     # One submodule is overridden to use a mirror.
@@ -524,12 +530,12 @@ def test_mirror_fallback_git_only_submodules(cli, tmpdir, 
datafiles):
 
     upstream_bin_repodir = os.path.join(str(tmpdir), "bin-upstream")
     mirror_bin_repodir = os.path.join(str(tmpdir), "bin-mirror")
-    upstream_bin_repo = create_repo("git", upstream_bin_repodir)
+    upstream_bin_repo = Git(upstream_bin_repodir)
     upstream_bin_repo.create(bin_files_path)
     mirror_bin_repo = upstream_bin_repo.copy(mirror_bin_repodir)
 
     dev_repodir = os.path.join(str(tmpdir), "dev-upstream")
-    dev_repo = create_repo("git", dev_repodir)
+    dev_repo = Git(dev_repodir)
     dev_repo.create(dev_files_path)
 
     main_files = os.path.join(str(tmpdir), "main-files")
@@ -537,7 +543,7 @@ def test_mirror_fallback_git_only_submodules(cli, tmpdir, 
datafiles):
     with open(os.path.join(main_files, "README"), "w", encoding="utf-8") as f:
         f.write("TEST\n")
     main_repodir = os.path.join(str(tmpdir), "main-upstream")
-    main_repo = create_repo("git", main_repodir)
+    main_repo = Git(main_repodir)
     main_repo.create(main_files)
 
     upstream_url = "file://{}".format(upstream_bin_repo.repo)
@@ -571,6 +577,13 @@ def test_mirror_fallback_git_only_submodules(cli, tmpdir, 
datafiles):
         "min-version": "2.0",
         "element-path": "elements",
         "aliases": {alias: upstream_map + "/"},
+        "plugins": [
+            {
+                "origin": "pip",
+                "package-name": "sample-plugins",
+                "sources": ["git"],
+            }
+        ],
         "mirrors": [
             {
                 "name": "middle-earth",
@@ -600,6 +613,7 @@ def test_mirror_fallback_git_only_submodules(cli, tmpdir, 
datafiles):
 
 
 @pytest.mark.datafiles(DATA_DIR)
[email protected]("not pip_sample_packages()", 
reason=SAMPLE_PACKAGES_SKIP_REASON)
 def test_mirror_fallback_git_with_submodules(cli, tmpdir, datafiles):
     # Main repo has mirror. But does not list submodules.
     #
@@ -610,11 +624,11 @@ def test_mirror_fallback_git_with_submodules(cli, tmpdir, 
datafiles):
     dev_files_path = os.path.join(str(datafiles), "files", "dev-files", "usr")
 
     bin_repodir = os.path.join(str(tmpdir), "bin-repo")
-    bin_repo = create_repo("git", bin_repodir)
+    bin_repo = Git(bin_repodir)
     bin_repo.create(bin_files_path)
 
     dev_repodir = os.path.join(str(tmpdir), "dev-repo")
-    dev_repo = create_repo("git", dev_repodir)
+    dev_repo = Git(dev_repodir)
     dev_repo.create(dev_files_path)
 
     main_files = os.path.join(str(tmpdir), "main-files")
@@ -622,7 +636,7 @@ def test_mirror_fallback_git_with_submodules(cli, tmpdir, 
datafiles):
     with open(os.path.join(main_files, "README"), "w", encoding="utf-8") as f:
         f.write("TEST\n")
     upstream_main_repodir = os.path.join(str(tmpdir), "main-upstream")
-    upstream_main_repo = create_repo("git", upstream_main_repodir)
+    upstream_main_repo = Git(upstream_main_repodir)
     upstream_main_repo.create(main_files)
 
     upstream_main_repo.add_submodule("bin", 
url="file://{}".format(bin_repo.repo))
@@ -664,6 +678,13 @@ def test_mirror_fallback_git_with_submodules(cli, tmpdir, 
datafiles):
         "min-version": "2.0",
         "element-path": "elements",
         "aliases": {alias: upstream_map + "/"},
+        "plugins": [
+            {
+                "origin": "pip",
+                "package-name": "sample-plugins",
+                "sources": ["git"],
+            }
+        ],
         "mirrors": [
             {
                 "name": "middle-earth",

Reply via email to