You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by ro...@apache.org on 2020/12/29 13:30:32 UTC

[buildstream] branch phil/remove-ostree-plugin created (now 40dfcfe)

This is an automated email from the ASF dual-hosted git repository.

root pushed a change to branch phil/remove-ostree-plugin
in repository https://gitbox.apache.org/repos/asf/buildstream.git.


      at 40dfcfe  fixup! fixup! fixup! fixup! fixup! fixup! fixup! Make templated source tests available in buildstream.plugintestutils

This branch includes the following new commits:

     new da5a629  testutils: move repo.py into buildstream.plugintestutils
     new 94d3106  plugintestutils: Add copy of testutils.junction.py
     new 79b59c9  plugintestutils._utils: Copy subset of tests.testutils.site
     new ae80b19  Make templated source tests available in buildstream.plugintestutils
     new ed855ab  fixup! Make templated source tests available in buildstream.plugintestutils
     new 05da69d  fixup! fixup! Make templated source tests available in buildstream.plugintestutils
     new d8c8d16  fixup! fixup! fixup! Make templated source tests available in buildstream.plugintestutils
     new 1ad1c41  fixup! fixup! fixup! fixup! Make templated source tests available in buildstream.plugintestutils
     new af2472e  fixup! fixup! fixup! fixup! fixup! Make templated source tests available in buildstream.plugintestutils
     new 074ab1c  fixup! fixup! fixup! fixup! fixup! fixup! Make templated source tests available in buildstream.plugintestutils
     new 40dfcfe  fixup! fixup! fixup! fixup! fixup! fixup! fixup! Make templated source tests available in buildstream.plugintestutils

The 11 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[buildstream] 04/11: Make templated source tests available in buildstream.plugintestutils

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

root pushed a commit to branch phil/remove-ostree-plugin
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit ae80b19b5beae341427a9ac3394c63d91d28bb8c
Author: Phil Dawson <ph...@codethink.co.uk>
AuthorDate: Tue Mar 26 09:49:17 2019 +0000

    Make templated source tests available in buildstream.plugintestutils
---
 buildstream/plugintestutils/__init__.py             | 21 ++++++++++++++++++++-
 .../plugintestutils/_sourcetests}/__init__.py       |  0
 .../plugintestutils/_sourcetests}/build_checkout.py |  0
 .../plugintestutils/_sourcetests}/fetch.py          | 15 +++++++++------
 .../plugintestutils/_sourcetests}/mirror.py         |  7 +++----
 .../_sourcetests}/project/elements/base.bst         |  0
 .../project/elements/base/base-alpine.bst           |  0
 .../_sourcetests}/project/elements/import-bin.bst   |  0
 .../_sourcetests}/project/elements/import-dev.bst   |  0
 .../elements/multiple_targets/dependency/horsey.bst |  0
 .../elements/multiple_targets/dependency/pony.bst   |  0
 .../elements/multiple_targets/dependency/zebry.bst  |  0
 .../project/elements/multiple_targets/order/0.bst   |  0
 .../project/elements/multiple_targets/order/1.bst   |  0
 .../project/elements/multiple_targets/order/2.bst   |  0
 .../project/elements/multiple_targets/order/3.bst   |  0
 .../project/elements/multiple_targets/order/4.bst   |  0
 .../project/elements/multiple_targets/order/5.bst   |  0
 .../project/elements/multiple_targets/order/6.bst   |  0
 .../project/elements/multiple_targets/order/7.bst   |  0
 .../project/elements/multiple_targets/order/8.bst   |  0
 .../project/elements/multiple_targets/order/9.bst   |  0
 .../project/elements/multiple_targets/order/run.bst |  0
 .../plugintestutils/_sourcetests}/project/files/bar |  0
 .../project/files/bin-files/usr/bin/hello           |  0
 .../project/files/dev-files/usr/include/pony.h      |  0
 .../project/files/etc-files/etc/buildstream/config  |  0
 .../plugintestutils/_sourcetests}/project/files/foo |  0
 .../project/files/source-bundle/llamas.txt          |  0
 .../files/sub-project/elements/import-etc.bst       |  0
 .../sub-project/files/etc-files/etc/animal.conf     |  0
 .../project/files/sub-project/project.conf          |  0
 .../_sourcetests}/project/project.conf              |  0
 .../_sourcetests}/source_determinism.py             |  7 +++----
 .../plugintestutils/_sourcetests}/track.py          | 15 +++++++++------
 .../_sourcetests}/track_cross_junction.py           |  7 +++----
 .../plugintestutils/_sourcetests}/workspace.py      |  4 ++--
 buildstream/plugintestutils/_utils/junction.py      |  4 ++--
 tests/sources/conftest.py                           |  7 +++++++
 39 files changed, 58 insertions(+), 29 deletions(-)

diff --git a/buildstream/plugintestutils/__init__.py b/buildstream/plugintestutils/__init__.py
index be0fd58..2029e20 100644
--- a/buildstream/plugintestutils/__init__.py
+++ b/buildstream/plugintestutils/__init__.py
@@ -15,8 +15,9 @@
 #  You should have received a copy of the GNU Lesser General Public
 #  License along with this library. If not, see <http://www.gnu.org/licenses/>.
 
+import os
 from collections import OrderedDict
-
+from . import _sourcetests
 from .repo import Repo
 from .runcli import cli, cli_integration, cli_remote_execution
 
@@ -62,3 +63,21 @@ def register_repo_kind(kind, cls):
     """
     ALL_REPO_KINDS[kind] = cls
 
+
+def sourcetests_collection_hook(session):
+    """ Used to hook the templated source plugin tests into a pyest test suite.
+
+    This should be called via the `pytest_sessionstart
+    hook<https://docs.pytest.org/en/latest/reference.html#collection-hooks>`.
+    The tests in the _sourcetests package will be collected as part of
+    whichever test package this hook is called from.
+
+    Args:
+        session (pytest.Session): The current pytest session
+    """
+    SOURCE_TESTS_PATH = os.path.dirname(_sourcetests.__file__)
+    # Add the location of the source tests to the session's
+    # python_files config. Without this, pytest may filter out these
+    # tests during collection.
+    session.config.addinivalue_line("python_files", os.path.join(SOURCE_TESTS_PATH, "/**.py"))
+    session.config.args.append(SOURCE_TESTS_PATH)
diff --git a/tests/sources/generic/__init__.py b/buildstream/plugintestutils/_sourcetests/__init__.py
similarity index 100%
rename from tests/sources/generic/__init__.py
rename to buildstream/plugintestutils/_sourcetests/__init__.py
diff --git a/tests/sources/generic/build_checkout.py b/buildstream/plugintestutils/_sourcetests/build_checkout.py
similarity index 100%
rename from tests/sources/generic/build_checkout.py
rename to buildstream/plugintestutils/_sourcetests/build_checkout.py
diff --git a/tests/sources/generic/fetch.py b/buildstream/plugintestutils/_sourcetests/fetch.py
similarity index 93%
rename from tests/sources/generic/fetch.py
rename to buildstream/plugintestutils/_sourcetests/fetch.py
index 52c8533..7e4210a 100644
--- a/tests/sources/generic/fetch.py
+++ b/buildstream/plugintestutils/_sourcetests/fetch.py
@@ -22,19 +22,22 @@
 import os
 import pytest
 
-from .._utils import generate_junction
-from buildstream.plugintestutils import create_repo, ALL_REPO_KINDS
-from tests.frontend import configure_project
-
-from buildstream.plugintestutils import cli  # pylint: disable=unused-import
 from buildstream import _yaml
-
+from .._utils import generate_junction
+from .. import create_repo, ALL_REPO_KINDS
+from .. import cli  # pylint: disable=unused-import
 
 # Project directory
 TOP_DIR = os.path.dirname(os.path.realpath(__file__))
 DATA_DIR = os.path.join(TOP_DIR, 'project')
 
 
+def configure_project(path, config):
+    config['name'] = 'test'
+    config['element-path'] = 'elements'
+    _yaml.dump(config, os.path.join(path, 'project.conf'))
+
+
 @pytest.mark.datafiles(DATA_DIR)
 @pytest.mark.parametrize("kind", [(kind) for kind in ALL_REPO_KINDS])
 def test_fetch(cli, tmpdir, datafiles, kind):
diff --git a/tests/sources/generic/mirror.py b/buildstream/plugintestutils/_sourcetests/mirror.py
similarity index 99%
rename from tests/sources/generic/mirror.py
rename to buildstream/plugintestutils/_sourcetests/mirror.py
index f17e388..44bf08a 100644
--- a/tests/sources/generic/mirror.py
+++ b/buildstream/plugintestutils/_sourcetests/mirror.py
@@ -22,12 +22,11 @@
 import os
 import pytest
 
-from .._utils import generate_junction
-
-from buildstream.plugintestutils import create_repo, ALL_REPO_KINDS
-from buildstream.plugintestutils import cli  # pylint: disable=unused-import
 from buildstream import _yaml
 from buildstream._exceptions import ErrorDomain
+from .._utils import generate_junction
+from .. import create_repo, ALL_REPO_KINDS
+from .. import cli  # pylint: disable=unused-import
 
 # Project directory
 TOP_DIR = os.path.dirname(os.path.realpath(__file__))
diff --git a/tests/sources/generic/project/elements/base.bst b/buildstream/plugintestutils/_sourcetests/project/elements/base.bst
similarity index 100%
rename from tests/sources/generic/project/elements/base.bst
rename to buildstream/plugintestutils/_sourcetests/project/elements/base.bst
diff --git a/tests/sources/generic/project/elements/base/base-alpine.bst b/buildstream/plugintestutils/_sourcetests/project/elements/base/base-alpine.bst
similarity index 100%
rename from tests/sources/generic/project/elements/base/base-alpine.bst
rename to buildstream/plugintestutils/_sourcetests/project/elements/base/base-alpine.bst
diff --git a/tests/sources/generic/project/elements/import-bin.bst b/buildstream/plugintestutils/_sourcetests/project/elements/import-bin.bst
similarity index 100%
rename from tests/sources/generic/project/elements/import-bin.bst
rename to buildstream/plugintestutils/_sourcetests/project/elements/import-bin.bst
diff --git a/tests/sources/generic/project/elements/import-dev.bst b/buildstream/plugintestutils/_sourcetests/project/elements/import-dev.bst
similarity index 100%
rename from tests/sources/generic/project/elements/import-dev.bst
rename to buildstream/plugintestutils/_sourcetests/project/elements/import-dev.bst
diff --git a/tests/sources/generic/project/elements/multiple_targets/dependency/horsey.bst b/buildstream/plugintestutils/_sourcetests/project/elements/multiple_targets/dependency/horsey.bst
similarity index 100%
rename from tests/sources/generic/project/elements/multiple_targets/dependency/horsey.bst
rename to buildstream/plugintestutils/_sourcetests/project/elements/multiple_targets/dependency/horsey.bst
diff --git a/tests/sources/generic/project/elements/multiple_targets/dependency/pony.bst b/buildstream/plugintestutils/_sourcetests/project/elements/multiple_targets/dependency/pony.bst
similarity index 100%
rename from tests/sources/generic/project/elements/multiple_targets/dependency/pony.bst
rename to buildstream/plugintestutils/_sourcetests/project/elements/multiple_targets/dependency/pony.bst
diff --git a/tests/sources/generic/project/elements/multiple_targets/dependency/zebry.bst b/buildstream/plugintestutils/_sourcetests/project/elements/multiple_targets/dependency/zebry.bst
similarity index 100%
rename from tests/sources/generic/project/elements/multiple_targets/dependency/zebry.bst
rename to buildstream/plugintestutils/_sourcetests/project/elements/multiple_targets/dependency/zebry.bst
diff --git a/tests/sources/generic/project/elements/multiple_targets/order/0.bst b/buildstream/plugintestutils/_sourcetests/project/elements/multiple_targets/order/0.bst
similarity index 100%
rename from tests/sources/generic/project/elements/multiple_targets/order/0.bst
rename to buildstream/plugintestutils/_sourcetests/project/elements/multiple_targets/order/0.bst
diff --git a/tests/sources/generic/project/elements/multiple_targets/order/1.bst b/buildstream/plugintestutils/_sourcetests/project/elements/multiple_targets/order/1.bst
similarity index 100%
rename from tests/sources/generic/project/elements/multiple_targets/order/1.bst
rename to buildstream/plugintestutils/_sourcetests/project/elements/multiple_targets/order/1.bst
diff --git a/tests/sources/generic/project/elements/multiple_targets/order/2.bst b/buildstream/plugintestutils/_sourcetests/project/elements/multiple_targets/order/2.bst
similarity index 100%
rename from tests/sources/generic/project/elements/multiple_targets/order/2.bst
rename to buildstream/plugintestutils/_sourcetests/project/elements/multiple_targets/order/2.bst
diff --git a/tests/sources/generic/project/elements/multiple_targets/order/3.bst b/buildstream/plugintestutils/_sourcetests/project/elements/multiple_targets/order/3.bst
similarity index 100%
rename from tests/sources/generic/project/elements/multiple_targets/order/3.bst
rename to buildstream/plugintestutils/_sourcetests/project/elements/multiple_targets/order/3.bst
diff --git a/tests/sources/generic/project/elements/multiple_targets/order/4.bst b/buildstream/plugintestutils/_sourcetests/project/elements/multiple_targets/order/4.bst
similarity index 100%
rename from tests/sources/generic/project/elements/multiple_targets/order/4.bst
rename to buildstream/plugintestutils/_sourcetests/project/elements/multiple_targets/order/4.bst
diff --git a/tests/sources/generic/project/elements/multiple_targets/order/5.bst b/buildstream/plugintestutils/_sourcetests/project/elements/multiple_targets/order/5.bst
similarity index 100%
rename from tests/sources/generic/project/elements/multiple_targets/order/5.bst
rename to buildstream/plugintestutils/_sourcetests/project/elements/multiple_targets/order/5.bst
diff --git a/tests/sources/generic/project/elements/multiple_targets/order/6.bst b/buildstream/plugintestutils/_sourcetests/project/elements/multiple_targets/order/6.bst
similarity index 100%
rename from tests/sources/generic/project/elements/multiple_targets/order/6.bst
rename to buildstream/plugintestutils/_sourcetests/project/elements/multiple_targets/order/6.bst
diff --git a/tests/sources/generic/project/elements/multiple_targets/order/7.bst b/buildstream/plugintestutils/_sourcetests/project/elements/multiple_targets/order/7.bst
similarity index 100%
rename from tests/sources/generic/project/elements/multiple_targets/order/7.bst
rename to buildstream/plugintestutils/_sourcetests/project/elements/multiple_targets/order/7.bst
diff --git a/tests/sources/generic/project/elements/multiple_targets/order/8.bst b/buildstream/plugintestutils/_sourcetests/project/elements/multiple_targets/order/8.bst
similarity index 100%
rename from tests/sources/generic/project/elements/multiple_targets/order/8.bst
rename to buildstream/plugintestutils/_sourcetests/project/elements/multiple_targets/order/8.bst
diff --git a/tests/sources/generic/project/elements/multiple_targets/order/9.bst b/buildstream/plugintestutils/_sourcetests/project/elements/multiple_targets/order/9.bst
similarity index 100%
rename from tests/sources/generic/project/elements/multiple_targets/order/9.bst
rename to buildstream/plugintestutils/_sourcetests/project/elements/multiple_targets/order/9.bst
diff --git a/tests/sources/generic/project/elements/multiple_targets/order/run.bst b/buildstream/plugintestutils/_sourcetests/project/elements/multiple_targets/order/run.bst
similarity index 100%
rename from tests/sources/generic/project/elements/multiple_targets/order/run.bst
rename to buildstream/plugintestutils/_sourcetests/project/elements/multiple_targets/order/run.bst
diff --git a/tests/sources/generic/project/files/bar b/buildstream/plugintestutils/_sourcetests/project/files/bar
similarity index 100%
rename from tests/sources/generic/project/files/bar
rename to buildstream/plugintestutils/_sourcetests/project/files/bar
diff --git a/tests/sources/generic/project/files/bin-files/usr/bin/hello b/buildstream/plugintestutils/_sourcetests/project/files/bin-files/usr/bin/hello
similarity index 100%
rename from tests/sources/generic/project/files/bin-files/usr/bin/hello
rename to buildstream/plugintestutils/_sourcetests/project/files/bin-files/usr/bin/hello
diff --git a/tests/sources/generic/project/files/dev-files/usr/include/pony.h b/buildstream/plugintestutils/_sourcetests/project/files/dev-files/usr/include/pony.h
similarity index 100%
rename from tests/sources/generic/project/files/dev-files/usr/include/pony.h
rename to buildstream/plugintestutils/_sourcetests/project/files/dev-files/usr/include/pony.h
diff --git a/tests/sources/generic/project/files/etc-files/etc/buildstream/config b/buildstream/plugintestutils/_sourcetests/project/files/etc-files/etc/buildstream/config
similarity index 100%
rename from tests/sources/generic/project/files/etc-files/etc/buildstream/config
rename to buildstream/plugintestutils/_sourcetests/project/files/etc-files/etc/buildstream/config
diff --git a/tests/sources/generic/project/files/foo b/buildstream/plugintestutils/_sourcetests/project/files/foo
similarity index 100%
rename from tests/sources/generic/project/files/foo
rename to buildstream/plugintestutils/_sourcetests/project/files/foo
diff --git a/tests/sources/generic/project/files/source-bundle/llamas.txt b/buildstream/plugintestutils/_sourcetests/project/files/source-bundle/llamas.txt
similarity index 100%
rename from tests/sources/generic/project/files/source-bundle/llamas.txt
rename to buildstream/plugintestutils/_sourcetests/project/files/source-bundle/llamas.txt
diff --git a/tests/sources/generic/project/files/sub-project/elements/import-etc.bst b/buildstream/plugintestutils/_sourcetests/project/files/sub-project/elements/import-etc.bst
similarity index 100%
rename from tests/sources/generic/project/files/sub-project/elements/import-etc.bst
rename to buildstream/plugintestutils/_sourcetests/project/files/sub-project/elements/import-etc.bst
diff --git a/tests/sources/generic/project/files/sub-project/files/etc-files/etc/animal.conf b/buildstream/plugintestutils/_sourcetests/project/files/sub-project/files/etc-files/etc/animal.conf
similarity index 100%
rename from tests/sources/generic/project/files/sub-project/files/etc-files/etc/animal.conf
rename to buildstream/plugintestutils/_sourcetests/project/files/sub-project/files/etc-files/etc/animal.conf
diff --git a/tests/sources/generic/project/files/sub-project/project.conf b/buildstream/plugintestutils/_sourcetests/project/files/sub-project/project.conf
similarity index 100%
rename from tests/sources/generic/project/files/sub-project/project.conf
rename to buildstream/plugintestutils/_sourcetests/project/files/sub-project/project.conf
diff --git a/tests/sources/generic/project/project.conf b/buildstream/plugintestutils/_sourcetests/project/project.conf
similarity index 100%
rename from tests/sources/generic/project/project.conf
rename to buildstream/plugintestutils/_sourcetests/project/project.conf
diff --git a/tests/sources/generic/source_determinism.py b/buildstream/plugintestutils/_sourcetests/source_determinism.py
similarity index 96%
rename from tests/sources/generic/source_determinism.py
rename to buildstream/plugintestutils/_sourcetests/source_determinism.py
index bd83da0..8597a70 100644
--- a/tests/sources/generic/source_determinism.py
+++ b/buildstream/plugintestutils/_sourcetests/source_determinism.py
@@ -22,11 +22,10 @@
 import os
 import pytest
 
-from .._utils.site import HAVE_SANDBOX
-
-from buildstream.plugintestutils import create_repo, ALL_REPO_KINDS
-from buildstream.plugintestutils import cli  # pylint: disable=unused-import
 from buildstream import _yaml
+from .._utils.site import HAVE_SANDBOX
+from .. import create_repo, ALL_REPO_KINDS
+from .. import cli  # pylint: disable=unused-import
 
 # Project directory
 TOP_DIR = os.path.dirname(os.path.realpath(__file__))
diff --git a/tests/sources/generic/track.py b/buildstream/plugintestutils/_sourcetests/track.py
similarity index 98%
rename from tests/sources/generic/track.py
rename to buildstream/plugintestutils/_sourcetests/track.py
index 9e53bc6..0dc3d96 100644
--- a/tests/sources/generic/track.py
+++ b/buildstream/plugintestutils/_sourcetests/track.py
@@ -22,20 +22,23 @@
 import os
 import pytest
 
-from tests.frontend import configure_project
-from .._utils import generate_junction
-
-from buildstream.plugintestutils import create_repo, ALL_REPO_KINDS
-from buildstream.plugintestutils import cli  # pylint: disable=unused-import
 from buildstream import _yaml
 from buildstream._exceptions import ErrorDomain
-
+from .._utils import generate_junction
+from .. import create_repo, ALL_REPO_KINDS
+from .. import cli  # pylint: disable=unused-import
 
 # Project directory
 TOP_DIR = os.path.dirname(os.path.realpath(__file__))
 DATA_DIR = os.path.join(TOP_DIR, 'project')
 
 
+def configure_project(path, config):
+    config['name'] = 'test'
+    config['element-path'] = 'elements'
+    _yaml.dump(config, os.path.join(path, 'project.conf'))
+
+
 def generate_element(repo, element_path, dep_name=None):
     element = {
         'kind': 'import',
diff --git a/tests/sources/generic/track_cross_junction.py b/buildstream/plugintestutils/_sourcetests/track_cross_junction.py
similarity index 97%
rename from tests/sources/generic/track_cross_junction.py
rename to buildstream/plugintestutils/_sourcetests/track_cross_junction.py
index 68db917..ece3e0b 100644
--- a/tests/sources/generic/track_cross_junction.py
+++ b/buildstream/plugintestutils/_sourcetests/track_cross_junction.py
@@ -22,11 +22,10 @@
 import os
 import pytest
 
-from .._utils import generate_junction
-
-from buildstream.plugintestutils import create_repo, ALL_REPO_KINDS 
-from buildstream.plugintestutils import cli  # pylint: disable=unused-import
 from buildstream import _yaml
+from .._utils import generate_junction
+from .. import create_repo, ALL_REPO_KINDS
+from .. import cli  # pylint: disable=unused-import
 
 # Project directory
 TOP_DIR = os.path.dirname(os.path.realpath(__file__))
diff --git a/tests/sources/generic/workspace.py b/buildstream/plugintestutils/_sourcetests/workspace.py
similarity index 97%
rename from tests/sources/generic/workspace.py
rename to buildstream/plugintestutils/_sourcetests/workspace.py
index 4da3a5b..5218f8f 100644
--- a/tests/sources/generic/workspace.py
+++ b/buildstream/plugintestutils/_sourcetests/workspace.py
@@ -23,9 +23,9 @@ import os
 import shutil
 import pytest
 
-from buildstream.plugintestutils import create_repo, ALL_REPO_KINDS
-from buildstream.plugintestutils import cli  # pylint: disable=unused-import
 from buildstream import _yaml
+from .. import create_repo, ALL_REPO_KINDS
+from .. import cli  # pylint: disable=unused-import
 
 # Project directory
 TOP_DIR = os.path.dirname(os.path.realpath(__file__))
diff --git a/buildstream/plugintestutils/_utils/junction.py b/buildstream/plugintestutils/_utils/junction.py
index 530a191..ca059eb 100644
--- a/buildstream/plugintestutils/_utils/junction.py
+++ b/buildstream/plugintestutils/_utils/junction.py
@@ -1,9 +1,9 @@
 import subprocess
 import pytest
 
-from .._utils.site import HAVE_GIT, GIT, GIT_ENV
-from buildstream.plugintestutils import Repo
 from buildstream import _yaml
+from .. import Repo
+from .site import HAVE_GIT, GIT, GIT_ENV
 
 
 # generate_junction()
diff --git a/tests/sources/conftest.py b/tests/sources/conftest.py
new file mode 100644
index 0000000..5fb1ef2
--- /dev/null
+++ b/tests/sources/conftest.py
@@ -0,0 +1,7 @@
+from buildstream.plugintestutils import sourcetests_collection_hook
+
+
+# This hook enables pytest to collect the templated source tests from
+# buildstream.plugintestutils
+def pytest_sessionstart(session):
+    sourcetests_collection_hook(session)


[buildstream] 06/11: fixup! fixup! Make templated source tests available in buildstream.plugintestutils

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

root pushed a commit to branch phil/remove-ostree-plugin
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 05da69d9e0619912fcd20ccc39963c5105066eb0
Author: Phil Dawson <ph...@codethink.co.uk>
AuthorDate: Wed Mar 27 16:11:01 2019 +0000

    fixup! fixup! Make templated source tests available in buildstream.plugintestutils
---
 setup.py | 1 -
 1 file changed, 1 deletion(-)

diff --git a/setup.py b/setup.py
index f9ed753..6fb54bb 100755
--- a/setup.py
+++ b/setup.py
@@ -325,7 +325,6 @@ setup(name='BuildStream',
                                     'data/*.yaml', 'data/*.sh.in'],
                     'buildstream.plugintestutils': ['_sourcetests/project']
       },
-      include_package_data=True,
       data_files=[
           # This is a weak attempt to integrate with the user nicely,
           # installing things outside of the python package itself with pip is


[buildstream] 05/11: fixup! Make templated source tests available in buildstream.plugintestutils

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

root pushed a commit to branch phil/remove-ostree-plugin
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit ed855ab5be768a4246809876219cc882bda2ea9a
Author: Phil Dawson <ph...@codethink.co.uk>
AuthorDate: Wed Mar 27 15:25:49 2019 +0000

    fixup! Make templated source tests available in buildstream.plugintestutils
---
 setup.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/setup.py b/setup.py
index 49b1154..f9ed753 100755
--- a/setup.py
+++ b/setup.py
@@ -322,7 +322,10 @@ setup(name='BuildStream',
       python_requires='~={}.{}'.format(REQUIRED_PYTHON_MAJOR, REQUIRED_PYTHON_MINOR),
       packages=find_packages(exclude=('tests', 'tests.*')),
       package_data={'buildstream': ['plugins/*/*.py', 'plugins/*/*.yaml',
-                                    'data/*.yaml', 'data/*.sh.in']},
+                                    'data/*.yaml', 'data/*.sh.in'],
+                    'buildstream.plugintestutils': ['_sourcetests/project']
+      },
+      include_package_data=True,
       data_files=[
           # This is a weak attempt to integrate with the user nicely,
           # installing things outside of the python package itself with pip is


[buildstream] 10/11: fixup! fixup! fixup! fixup! fixup! fixup! Make templated source tests available in buildstream.plugintestutils

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

root pushed a commit to branch phil/remove-ostree-plugin
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 074ab1c6266aebf96b597dd9f0f1cc88def26a12
Author: Phil Dawson <ph...@codethink.co.uk>
AuthorDate: Wed Mar 27 16:23:28 2019 +0000

    fixup! fixup! fixup! fixup! fixup! fixup! Make templated source tests available in buildstream.plugintestutils
---
 setup.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/setup.py b/setup.py
index fb7e193..6fb54bb 100755
--- a/setup.py
+++ b/setup.py
@@ -323,9 +323,8 @@ setup(name='BuildStream',
       packages=find_packages(exclude=('tests', 'tests.*')),
       package_data={'buildstream': ['plugins/*/*.py', 'plugins/*/*.yaml',
                                     'data/*.yaml', 'data/*.sh.in'],
-                    'buildstream.plugintestutils': ['_sourcetests/project/*']
+                    'buildstream.plugintestutils': ['_sourcetests/project']
       },
-      include_package_data=True,
       data_files=[
           # This is a weak attempt to integrate with the user nicely,
           # installing things outside of the python package itself with pip is


[buildstream] 03/11: plugintestutils._utils: Copy subset of tests.testutils.site

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

root pushed a commit to branch phil/remove-ostree-plugin
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 79b59c97620d1cf62fe6a32d4fb7a600dc840df4
Author: Phil Dawson <ph...@codethink.co.uk>
AuthorDate: Tue Mar 26 09:46:32 2019 +0000

    plugintestutils._utils: Copy subset of tests.testutils.site
    
    A subset of the functionality provided by this module is not
    available from buildstream._site but is necessary for the templated
    source plugin tests.
---
 buildstream/plugintestutils/_utils/site.py  | 46 +++++++++++++++++++++++++++++
 tests/sources/generic/source_determinism.py |  2 +-
 2 files changed, 47 insertions(+), 1 deletion(-)

diff --git a/buildstream/plugintestutils/_utils/site.py b/buildstream/plugintestutils/_utils/site.py
new file mode 100644
index 0000000..54c5b46
--- /dev/null
+++ b/buildstream/plugintestutils/_utils/site.py
@@ -0,0 +1,46 @@
+# Some things resolved about the execution site,
+# so we dont have to repeat this everywhere
+#
+import os
+import sys
+import platform
+
+from buildstream import _site, utils, ProgramNotFoundError
+
+
+try:
+    GIT = utils.get_host_tool('git')
+    HAVE_GIT = True
+    GIT_ENV = {
+        'GIT_AUTHOR_DATE': '1320966000 +0200',
+        'GIT_AUTHOR_NAME': 'tomjon',
+        'GIT_AUTHOR_EMAIL': 'tom@jon.com',
+        'GIT_COMMITTER_DATE': '1320966000 +0200',
+        'GIT_COMMITTER_NAME': 'tomjon',
+        'GIT_COMMITTER_EMAIL': 'tom@jon.com'
+    }
+except ProgramNotFoundError:
+    GIT = None
+    HAVE_GIT = False
+    GIT_ENV = dict()
+
+try:
+    utils.get_host_tool('bwrap')
+    HAVE_BWRAP = True
+    HAVE_BWRAP_JSON_STATUS = _site.get_bwrap_version() >= (0, 3, 2)
+except ProgramNotFoundError:
+    HAVE_BWRAP = False
+    HAVE_BWRAP_JSON_STATUS = False
+
+IS_LINUX = os.getenv('BST_FORCE_BACKEND', sys.platform).startswith('linux')
+IS_WSL = (IS_LINUX and 'Microsoft' in platform.uname().release)
+IS_WINDOWS = (os.name == 'nt')
+
+if not IS_LINUX:
+    HAVE_SANDBOX = True   # fallback to a chroot sandbox on unix
+elif IS_WSL:
+    HAVE_SANDBOX = False  # Sandboxes are inoperable under WSL due to lack of FUSE
+elif IS_LINUX and HAVE_BWRAP:
+    HAVE_SANDBOX = True
+else:
+    HAVE_SANDBOX = False
diff --git a/tests/sources/generic/source_determinism.py b/tests/sources/generic/source_determinism.py
index e3203a8..bd83da0 100644
--- a/tests/sources/generic/source_determinism.py
+++ b/tests/sources/generic/source_determinism.py
@@ -22,7 +22,7 @@
 import os
 import pytest
 
-from tests.testutils.site import HAVE_SANDBOX
+from .._utils.site import HAVE_SANDBOX
 
 from buildstream.plugintestutils import create_repo, ALL_REPO_KINDS
 from buildstream.plugintestutils import cli  # pylint: disable=unused-import


[buildstream] 02/11: plugintestutils: Add copy of testutils.junction.py

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

root pushed a commit to branch phil/remove-ostree-plugin
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 94d31066d2801a75520a06f3c40ba2fe06bec5be
Author: Phil Dawson <ph...@codethink.co.uk>
AuthorDate: Tue Mar 26 09:32:14 2019 +0000

    plugintestutils: Add copy of testutils.junction.py
    
    Copy tests.testutils.junction into plugintestutils._utils. This is
    needed for use by the templated source tests.
---
 buildstream/plugintestutils/_utils/__init__.py |  1 +
 buildstream/plugintestutils/_utils/junction.py | 83 ++++++++++++++++++++++++++
 tests/sources/generic/fetch.py                 |  2 +-
 tests/sources/generic/mirror.py                |  2 +-
 tests/sources/generic/track.py                 |  2 +-
 tests/sources/generic/track_cross_junction.py  |  2 +-
 6 files changed, 88 insertions(+), 4 deletions(-)

diff --git a/buildstream/plugintestutils/_utils/__init__.py b/buildstream/plugintestutils/_utils/__init__.py
new file mode 100644
index 0000000..5938e6a
--- /dev/null
+++ b/buildstream/plugintestutils/_utils/__init__.py
@@ -0,0 +1 @@
+from .junction import generate_junction
diff --git a/buildstream/plugintestutils/_utils/junction.py b/buildstream/plugintestutils/_utils/junction.py
new file mode 100644
index 0000000..530a191
--- /dev/null
+++ b/buildstream/plugintestutils/_utils/junction.py
@@ -0,0 +1,83 @@
+import subprocess
+import pytest
+
+from .._utils.site import HAVE_GIT, GIT, GIT_ENV
+from buildstream.plugintestutils import Repo
+from buildstream import _yaml
+
+
+# generate_junction()
+#
+# Generates a junction element with a git repository
+#
+# Args:
+#    tmpdir: The tmpdir fixture, for storing the generated git repo
+#    subproject_path: The path for the subproject, to add to the git repo
+#    junction_path: The location to store the generated junction element
+#    store_ref: Whether to store the ref in the junction.bst file
+#
+# Returns:
+#    (str): The ref
+#
+def generate_junction(tmpdir, subproject_path, junction_path, *, store_ref=True):
+    # Create a repo to hold the subproject and generate
+    # a junction element for it
+    #
+    repo = _SimpleGit(str(tmpdir))
+    source_ref = ref = repo.create(subproject_path)
+    if not store_ref:
+        source_ref = None
+
+    element = {
+        'kind': 'junction',
+        'sources': [
+            repo.source_config(ref=source_ref)
+        ]
+    }
+    _yaml.dump(element, junction_path)
+
+    return ref
+
+
+# A barebones Git Repo class to use for generating junctions
+class _SimpleGit(Repo):
+    def __init__(self, directory, subdir='repo'):
+        if not HAVE_GIT:
+            pytest.skip('git is not available')
+        super().__init__(directory, subdir)
+
+    def create(self, directory):
+        self.copy_directory(directory, self.repo)
+        self._run_git('init', '.')
+        self._run_git('add', '.')
+        self._run_git('commit', '-m', 'Initial commit')
+        return self.latest_commit()
+
+    def latest_commit(self):
+        return self._run_git(
+            'rev-parse', 'HEAD',
+            stdout=subprocess.PIPE,
+            universal_newlines=True,
+        ).stdout.strip()
+
+    def source_config(self, ref=None, checkout_submodules=None):
+        config = {
+            'kind': 'git',
+            'url': 'file://' + self.repo,
+            'track': 'master'
+        }
+        if ref is not None:
+            config['ref'] = ref
+        if checkout_submodules is not None:
+            config['checkout-submodules'] = checkout_submodules
+
+        return config
+
+    def _run_git(self, *args, **kwargs):
+        argv = [GIT]
+        argv.extend(args)
+        if 'env' not in kwargs:
+            kwargs['env'] = dict(GIT_ENV, PWD=self.repo)
+        kwargs.setdefault('cwd', self.repo)
+        kwargs.setdefault('check', True)
+        return subprocess.run(argv, **kwargs)
diff --git a/tests/sources/generic/fetch.py b/tests/sources/generic/fetch.py
index f8c6b55..52c8533 100644
--- a/tests/sources/generic/fetch.py
+++ b/tests/sources/generic/fetch.py
@@ -22,7 +22,7 @@
 import os
 import pytest
 
-from tests.testutils import generate_junction
+from .._utils import generate_junction
 from buildstream.plugintestutils import create_repo, ALL_REPO_KINDS
 from tests.frontend import configure_project
 
diff --git a/tests/sources/generic/mirror.py b/tests/sources/generic/mirror.py
index f52efcd..f17e388 100644
--- a/tests/sources/generic/mirror.py
+++ b/tests/sources/generic/mirror.py
@@ -22,7 +22,7 @@
 import os
 import pytest
 
-from tests.testutils import generate_junction
+from .._utils import generate_junction
 
 from buildstream.plugintestutils import create_repo, ALL_REPO_KINDS
 from buildstream.plugintestutils import cli  # pylint: disable=unused-import
diff --git a/tests/sources/generic/track.py b/tests/sources/generic/track.py
index 881046a..9e53bc6 100644
--- a/tests/sources/generic/track.py
+++ b/tests/sources/generic/track.py
@@ -22,8 +22,8 @@
 import os
 import pytest
 
-from tests.testutils import generate_junction
 from tests.frontend import configure_project
+from .._utils import generate_junction
 
 from buildstream.plugintestutils import create_repo, ALL_REPO_KINDS
 from buildstream.plugintestutils import cli  # pylint: disable=unused-import
diff --git a/tests/sources/generic/track_cross_junction.py b/tests/sources/generic/track_cross_junction.py
index 7cf0496..68db917 100644
--- a/tests/sources/generic/track_cross_junction.py
+++ b/tests/sources/generic/track_cross_junction.py
@@ -22,7 +22,7 @@
 import os
 import pytest
 
-from tests.testutils import generate_junction
+from .._utils import generate_junction
 
 from buildstream.plugintestutils import create_repo, ALL_REPO_KINDS 
 from buildstream.plugintestutils import cli  # pylint: disable=unused-import


[buildstream] 07/11: fixup! fixup! fixup! Make templated source tests available in buildstream.plugintestutils

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

root pushed a commit to branch phil/remove-ostree-plugin
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit d8c8d16e2be462c88d45572f98920235d2fbbd0d
Author: Phil Dawson <ph...@codethink.co.uk>
AuthorDate: Wed Mar 27 16:12:22 2019 +0000

    fixup! fixup! fixup! Make templated source tests available in buildstream.plugintestutils
---
 setup.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/setup.py b/setup.py
index 6fb54bb..f9ed753 100755
--- a/setup.py
+++ b/setup.py
@@ -325,6 +325,7 @@ setup(name='BuildStream',
                                     'data/*.yaml', 'data/*.sh.in'],
                     'buildstream.plugintestutils': ['_sourcetests/project']
       },
+      include_package_data=True,
       data_files=[
           # This is a weak attempt to integrate with the user nicely,
           # installing things outside of the python package itself with pip is


[buildstream] 09/11: fixup! fixup! fixup! fixup! fixup! Make templated source tests available in buildstream.plugintestutils

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

root pushed a commit to branch phil/remove-ostree-plugin
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit af2472eb8235188c81b6e87ae70df06b9812098a
Author: Phil Dawson <ph...@codethink.co.uk>
AuthorDate: Wed Mar 27 16:22:47 2019 +0000

    fixup! fixup! fixup! fixup! fixup! Make templated source tests available in buildstream.plugintestutils
---
 MANIFEST.in | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MANIFEST.in b/MANIFEST.in
index b9f56e2..4365f0d 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -6,6 +6,7 @@ include MAINTAINERS
 include NEWS
 include README.rst
 
+# Data files required by BuildStream's generic source tests
 recursive-include buildstream/plugintestutils/_sourcetests/project *
 
 # Documentation package includes


[buildstream] 11/11: fixup! fixup! fixup! fixup! fixup! fixup! fixup! Make templated source tests available in buildstream.plugintestutils

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

root pushed a commit to branch phil/remove-ostree-plugin
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 40dfcfec5d454a9e846fdeeec521c0fefa938af6
Author: Phil Dawson <ph...@codethink.co.uk>
AuthorDate: Wed Mar 27 16:50:57 2019 +0000

    fixup! fixup! fixup! fixup! fixup! fixup! fixup! Make templated source tests available in buildstream.plugintestutils
---
 setup.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/setup.py b/setup.py
index 6fb54bb..b360ed5 100755
--- a/setup.py
+++ b/setup.py
@@ -323,8 +323,8 @@ setup(name='BuildStream',
       packages=find_packages(exclude=('tests', 'tests.*')),
       package_data={'buildstream': ['plugins/*/*.py', 'plugins/*/*.yaml',
                                     'data/*.yaml', 'data/*.sh.in'],
-                    'buildstream.plugintestutils': ['_sourcetests/project']
       },
+      include_package_data=True,
       data_files=[
           # This is a weak attempt to integrate with the user nicely,
           # installing things outside of the python package itself with pip is


[buildstream] 01/11: testutils: move repo.py into buildstream.plugintestutils

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

root pushed a commit to branch phil/remove-ostree-plugin
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit da5a629dcb8073f247d0c3c1e92fbacab21651e2
Author: Phil Dawson <ph...@codethink.co.uk>
AuthorDate: Mon Mar 25 18:30:01 2019 +0000

    testutils: move repo.py into buildstream.plugintestutils
    
    This needs to be exposed as part of the plugin author facing API so
    that plugin authors can define custom repo types which will can be
    passed to the set of tests which iterate over multiple source types.
    
    Part of the work towards #944
---
 buildstream/plugintestutils/__init__.py       |  34 ++++++++
 buildstream/plugintestutils/repo.py           | 109 ++++++++++++++++++++++++++
 tests/elements/filter.py                      |   2 +-
 tests/format/include.py                       |   4 +-
 tests/format/junctions.py                     |   2 +-
 tests/frontend/buildtrack.py                  |   3 +-
 tests/frontend/cross_junction_workspace.py    |   3 +-
 tests/frontend/fetch.py                       |   4 +-
 tests/frontend/logging.py                     |   2 +-
 tests/frontend/mirror.py                      |   3 +-
 tests/frontend/order.py                       |   2 +-
 tests/frontend/track.py                       |   4 +-
 tests/frontend/workspace.py                   |   4 +-
 tests/integration/source-determinism.py       |   2 +-
 tests/sourcecache/fetch.py                    |   4 +-
 tests/sourcecache/push.py                     |   3 +-
 tests/sources/__init__.py                     |  13 +++
 tests/sources/bzr.py                          |   2 +-
 tests/sources/generic/build_checkout.py       |   3 +-
 tests/sources/generic/fetch.py                |   3 +-
 tests/sources/generic/mirror.py               |   3 +-
 tests/sources/generic/source_determinism.py   |   2 +-
 tests/sources/generic/track.py                |   3 +-
 tests/sources/generic/track_cross_junction.py |   3 +-
 tests/sources/generic/workspace.py            |   3 +-
 tests/sources/git.py                          |   2 +-
 tests/sources/no_fetch_cached.py              |   2 +-
 tests/sources/ostree.py                       |   3 +-
 tests/testutils/__init__.py                   |   1 -
 tests/testutils/element_generators.py         |   3 +-
 tests/testutils/junction.py                   |   2 +-
 tests/testutils/repo/__init__.py              |  31 --------
 tests/testutils/repo/bzr.py                   |   2 +-
 tests/testutils/repo/git.py                   |   2 +-
 tests/testutils/repo/ostree.py                |   2 +-
 tests/testutils/repo/repo.py                  |  90 ---------------------
 tests/testutils/repo/tar.py                   |   2 +-
 tests/testutils/repo/zip.py                   |   2 +-
 38 files changed, 198 insertions(+), 166 deletions(-)

diff --git a/buildstream/plugintestutils/__init__.py b/buildstream/plugintestutils/__init__.py
index 9ec18df..be0fd58 100644
--- a/buildstream/plugintestutils/__init__.py
+++ b/buildstream/plugintestutils/__init__.py
@@ -15,7 +15,9 @@
 #  You should have received a copy of the GNU Lesser General Public
 #  License along with this library. If not, see <http://www.gnu.org/licenses/>.
 
+from collections import OrderedDict
 
+from .repo import Repo
 from .runcli import cli, cli_integration, cli_remote_execution
 
 # To make use of these test utilities it is necessary to have pytest
@@ -28,3 +30,35 @@ except ImportError:
     msg = "Could not import pytest:\n" \
           "To use the {} module, you must have pytest installed.".format(module_name)
     raise ImportError(msg)
+
+
+ALL_REPO_KINDS = OrderedDict()
+
+
+def create_repo(kind, directory, subdir='repo'):
+    """Convenience method for creating a Repo
+
+    Args:
+        kind (str): The kind of repo to create (a source plugin basename)
+        directory (str): The path where the repo will keep a cache
+
+    Returns:
+        (Repo): A new Repo object
+    """
+    try:
+        constructor = ALL_REPO_KINDS[kind]
+    except KeyError as e:
+        raise AssertionError("Unsupported repo kind {}".format(kind)) from e
+
+    return constructor(directory, subdir=subdir)
+
+
+def register_repo_kind(kind, cls):
+    """ Register a new repo kind on which to run the generic source tests.
+
+    Args:
+       kind (str): The kind of repo to create (a source plugin basename)
+       cls (cls) : A class derived from Repo.
+    """
+    ALL_REPO_KINDS[kind] = cls
+
diff --git a/buildstream/plugintestutils/repo.py b/buildstream/plugintestutils/repo.py
new file mode 100644
index 0000000..009a8bc
--- /dev/null
+++ b/buildstream/plugintestutils/repo.py
@@ -0,0 +1,109 @@
+#
+#  Copyright (C) 2016-2018 Codethink Limited
+#  Copyright (C) 2019 Bloomberg Finance LP
+#
+#  This program is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU Lesser General Public
+#  License as published by the Free Software Foundation; either
+#  version 2 of the License, or (at your option) any later version.
+#
+#  This library is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+#  Lesser General Public License for more details.
+#
+#  You should have received a copy of the GNU Lesser General Public
+#  License along with this library. If not, see <http://www.gnu.org/licenses/>.
+
+"""
+Repo - Utility class for testing source plugins
+===============================================
+
+
+"""
+import os
+import shutil
+
+
+class Repo():
+    """Repo()
+
+    Abstract class providing scaffolding for generating data to be
+    used with various sources. Subclasses of Repo may be registered to
+    run through the suite of suite of generic source plugin tests
+    provided in buildstream.plugintestutils.
+
+    Args:
+    directory (str): The base temp directory for the test
+    subdir (str): The subdir for the repo, in case there is more than one
+
+    """
+    def __init__(self, directory, subdir='repo'):
+
+        # The working directory for the repo object
+        #
+        self.directory = os.path.abspath(directory)
+
+        # The directory the actual repo will be stored in
+        self.repo = os.path.join(self.directory, subdir)
+
+        os.makedirs(self.repo, exist_ok=True)
+
+    def create(self, directory):
+        """Create a repository in self.directory and add the initial content
+
+        Args:
+            directory: A directory with content to commit
+
+        Returns:
+            (smth): A new ref corresponding to this commit, which can
+                    be passed as the ref in the Repo.source_config() API.
+        """
+        raise NotImplementedError("create method has not been implemeted")
+
+    def source_config(self, ref=None):
+        """
+        Args:
+            ref (smth): An optional abstract ref object, usually a string.
+
+        Returns:
+            (dict): A configuration which can be serialized as a
+                    source when generating an element file on the fly
+
+        """
+        raise NotImplementedError("source_config method has not been implemeted")
+
+    def copy_directory(self, src, dest):
+        """ Copies the content of src to the directory dest
+
+        Like shutil.copytree(), except dest is expected
+        to exist.
+
+        Args:
+            src (str): The source directory
+            dest (str): The destination directory
+        """
+        for filename in os.listdir(src):
+            src_path = os.path.join(src, filename)
+            dest_path = os.path.join(dest, filename)
+            if os.path.isdir(src_path):
+                shutil.copytree(src_path, dest_path)
+            else:
+                shutil.copy2(src_path, dest_path)
+
+    def copy(self, dest):
+        """Creates a copy of this repository in the specified destination.
+
+        Args:
+        dest (str): The destination directory
+
+        Returns:
+        (Repo): A Repo object for the new repository.
+        """
+        subdir = self.repo[len(self.directory):].lstrip(os.sep)
+        new_dir = os.path.join(dest, subdir)
+        os.makedirs(new_dir, exist_ok=True)
+        self.copy_directory(self.repo, new_dir)
+        repo_type = type(self)
+        new_repo = repo_type(dest, subdir)
+        return new_repo
diff --git a/tests/elements/filter.py b/tests/elements/filter.py
index afc4286..454682d 100644
--- a/tests/elements/filter.py
+++ b/tests/elements/filter.py
@@ -6,7 +6,7 @@ import shutil
 
 import pytest
 
-from tests.testutils import create_repo
+from buildstream.plugintestutils import create_repo
 from buildstream.plugintestutils import cli  # pylint: disable=unused-import
 from buildstream._exceptions import ErrorDomain
 from buildstream import _yaml
diff --git a/tests/format/include.py b/tests/format/include.py
index 455ccd4..3163cc0 100644
--- a/tests/format/include.py
+++ b/tests/format/include.py
@@ -7,8 +7,8 @@ import pytest
 from buildstream import _yaml
 from buildstream._exceptions import ErrorDomain, LoadErrorReason
 from buildstream.plugintestutils import cli  # pylint: disable=unused-import
-
-from tests.testutils import generate_junction, create_repo
+from buildstream.plugintestutils import create_repo
+from tests.testutils import generate_junction
 
 
 # Project directory
diff --git a/tests/format/junctions.py b/tests/format/junctions.py
index 3a21576..94562cb 100644
--- a/tests/format/junctions.py
+++ b/tests/format/junctions.py
@@ -9,7 +9,7 @@ import pytest
 from buildstream import _yaml
 from buildstream._exceptions import ErrorDomain, LoadErrorReason
 from buildstream.plugintestutils import cli  # pylint: disable=unused-import
-from tests.testutils import create_repo
+from buildstream.plugintestutils import create_repo
 from tests.testutils.site import HAVE_GIT
 
 
diff --git a/tests/frontend/buildtrack.py b/tests/frontend/buildtrack.py
index 5a3781d..d4dc93a 100644
--- a/tests/frontend/buildtrack.py
+++ b/tests/frontend/buildtrack.py
@@ -8,9 +8,8 @@ import itertools
 
 import pytest
 
-from tests.testutils import create_repo
-
 from buildstream import _yaml
+from buildstream.plugintestutils import create_repo
 from buildstream.plugintestutils import cli  # pylint: disable=unused-import
 from buildstream._exceptions import ErrorDomain
 
diff --git a/tests/frontend/cross_junction_workspace.py b/tests/frontend/cross_junction_workspace.py
index 7b1fc7f..30a3b5b 100644
--- a/tests/frontend/cross_junction_workspace.py
+++ b/tests/frontend/cross_junction_workspace.py
@@ -3,10 +3,9 @@
 
 import os
 from buildstream.plugintestutils import cli  # pylint: disable=unused-import
+from buildstream.plugintestutils import create_repo
 from buildstream import _yaml
 
-from tests.testutils import create_repo
-
 
 def prepare_junction_project(cli, tmpdir):
     main_project = tmpdir.join("main")
diff --git a/tests/frontend/fetch.py b/tests/frontend/fetch.py
index 8282e21..cea7ff1 100644
--- a/tests/frontend/fetch.py
+++ b/tests/frontend/fetch.py
@@ -4,8 +4,8 @@
 import os
 import pytest
 
-from tests.testutils import create_repo, generate_junction, yaml_file_get_provenance
-
+from tests.testutils import generate_junction, yaml_file_get_provenance
+from buildstream.plugintestutils import create_repo
 from buildstream.plugintestutils import cli  # pylint: disable=unused-import
 from buildstream import _yaml
 from buildstream._exceptions import ErrorDomain, LoadErrorReason
diff --git a/tests/frontend/logging.py b/tests/frontend/logging.py
index 4036a46..49e3a70 100644
--- a/tests/frontend/logging.py
+++ b/tests/frontend/logging.py
@@ -6,7 +6,7 @@ import re
 
 import pytest
 
-from tests.testutils import create_repo
+from buildstream.plugintestutils import create_repo
 
 from buildstream import _yaml
 from buildstream._exceptions import ErrorDomain
diff --git a/tests/frontend/mirror.py b/tests/frontend/mirror.py
index b33d889..47f9428 100644
--- a/tests/frontend/mirror.py
+++ b/tests/frontend/mirror.py
@@ -4,9 +4,8 @@
 import os
 import pytest
 
-from tests.testutils import create_repo
-
 from buildstream import _yaml
+from buildstream.plugintestutils import create_repo
 from buildstream.plugintestutils import cli  # pylint: disable=unused-import
 
 
diff --git a/tests/frontend/order.py b/tests/frontend/order.py
index cd75aa6..5eb5b29 100644
--- a/tests/frontend/order.py
+++ b/tests/frontend/order.py
@@ -4,7 +4,7 @@
 import os
 
 import pytest
-from tests.testutils import create_repo
+from buildstream.plugintestutils import create_repo
 from buildstream.plugintestutils import cli  # pylint: disable=unused-import
 from buildstream import _yaml
 
diff --git a/tests/frontend/track.py b/tests/frontend/track.py
index 13d1d46..9c7ab90 100644
--- a/tests/frontend/track.py
+++ b/tests/frontend/track.py
@@ -4,12 +4,12 @@
 import stat
 import os
 import pytest
-from tests.testutils import create_repo, generate_junction, yaml_file_get_provenance
 
+from buildstream.plugintestutils import create_repo
 from buildstream.plugintestutils import cli  # pylint: disable=unused-import
 from buildstream._exceptions import ErrorDomain, LoadErrorReason
 from buildstream import _yaml
-
+from tests.testutils import generate_junction, yaml_file_get_provenance
 from . import configure_project
 
 # Project directory
diff --git a/tests/frontend/workspace.py b/tests/frontend/workspace.py
index 204cfb7..4ddb5ef 100644
--- a/tests/frontend/workspace.py
+++ b/tests/frontend/workspace.py
@@ -34,9 +34,9 @@ import subprocess
 
 import pytest
 
-from tests.testutils import create_repo, ALL_REPO_KINDS, wait_for_cache_granularity
-from tests.testutils import create_artifact_share, create_element_size
+from tests.testutils import create_artifact_share, create_element_size, wait_for_cache_granularity
 
+from buildstream.plugintestutils import create_repo, ALL_REPO_KINDS
 from buildstream.plugintestutils import cli  # pylint: disable=unused-import
 from buildstream import _yaml
 from buildstream._exceptions import ErrorDomain, LoadErrorReason
diff --git a/tests/integration/source-determinism.py b/tests/integration/source-determinism.py
index 7cfca98..2f63a4a 100644
--- a/tests/integration/source-determinism.py
+++ b/tests/integration/source-determinism.py
@@ -3,7 +3,7 @@ import pytest
 
 from buildstream import _yaml
 from buildstream.plugintestutils import cli_integration as cli
-from tests.testutils import create_repo
+from buildstream.plugintestutils import create_repo
 from tests.testutils.site import HAVE_SANDBOX
 
 
diff --git a/tests/sourcecache/fetch.py b/tests/sourcecache/fetch.py
index 86d2138..7f82388 100644
--- a/tests/sourcecache/fetch.py
+++ b/tests/sourcecache/fetch.py
@@ -28,8 +28,8 @@ from buildstream._context import Context
 from buildstream._project import Project
 from buildstream import _yaml
 from buildstream.plugintestutils import cli  # pylint: disable=unused-import
-
-from tests.testutils import create_artifact_share, create_repo
+from buildstream.plugintestutils import create_repo
+from tests.testutils import create_artifact_share
 
 DATA_DIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), "project")
 
diff --git a/tests/sourcecache/push.py b/tests/sourcecache/push.py
index f692136..825d261 100644
--- a/tests/sourcecache/push.py
+++ b/tests/sourcecache/push.py
@@ -28,8 +28,9 @@ from buildstream._exceptions import ErrorDomain
 from buildstream._project import Project
 from buildstream import _yaml
 from buildstream.plugintestutils import cli  # pylint: disable=unused-import
+from buildstream.plugintestutils import create_repo
 
-from tests.testutils import create_artifact_share, create_repo
+from tests.testutils import create_artifact_share
 
 DATA_DIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), "project")
 
diff --git a/tests/sources/__init__.py b/tests/sources/__init__.py
index 02a7550..155ecc0 100644
--- a/tests/sources/__init__.py
+++ b/tests/sources/__init__.py
@@ -1,5 +1,18 @@
 import os
 
+from buildstream.plugintestutils import register_repo_kind
+from tests.testutils.repo.git import Git
+from tests.testutils.repo.bzr import Bzr
+from tests.testutils.repo.ostree import OSTree
+from tests.testutils.repo.tar import Tar
+from tests.testutils.repo.zip import Zip
+
+register_repo_kind('git', Git)
+register_repo_kind('bzr', Bzr)
+register_repo_kind('ostree', OSTree)
+register_repo_kind('tar', Tar)
+register_repo_kind('zip', Zip)
+
 
 def list_dir_contents(srcdir):
     contents = set()
diff --git a/tests/sources/bzr.py b/tests/sources/bzr.py
index 0a3c345..bf02223 100644
--- a/tests/sources/bzr.py
+++ b/tests/sources/bzr.py
@@ -7,7 +7,7 @@ import pytest
 from buildstream import _yaml
 
 from buildstream.plugintestutils import cli  # pylint: disable=unused-import
-from tests.testutils import create_repo
+from buildstream.plugintestutils import create_repo
 from tests.testutils.site import HAVE_BZR
 
 DATA_DIR = os.path.join(
diff --git a/tests/sources/generic/build_checkout.py b/tests/sources/generic/build_checkout.py
index e113b40..074be84 100644
--- a/tests/sources/generic/build_checkout.py
+++ b/tests/sources/generic/build_checkout.py
@@ -22,8 +22,7 @@
 import os
 import pytest
 
-from tests.testutils import create_repo, ALL_REPO_KINDS
-
+from buildstream.plugintestutils import create_repo, ALL_REPO_KINDS
 from buildstream.plugintestutils import cli  # pylint: disable=unused-import
 from buildstream import _yaml
 
diff --git a/tests/sources/generic/fetch.py b/tests/sources/generic/fetch.py
index f5931f8..f8c6b55 100644
--- a/tests/sources/generic/fetch.py
+++ b/tests/sources/generic/fetch.py
@@ -22,7 +22,8 @@
 import os
 import pytest
 
-from tests.testutils import create_repo, ALL_REPO_KINDS, generate_junction
+from tests.testutils import generate_junction
+from buildstream.plugintestutils import create_repo, ALL_REPO_KINDS
 from tests.frontend import configure_project
 
 from buildstream.plugintestutils import cli  # pylint: disable=unused-import
diff --git a/tests/sources/generic/mirror.py b/tests/sources/generic/mirror.py
index f5a11d2..f52efcd 100644
--- a/tests/sources/generic/mirror.py
+++ b/tests/sources/generic/mirror.py
@@ -22,8 +22,9 @@
 import os
 import pytest
 
-from tests.testutils import create_repo, ALL_REPO_KINDS, generate_junction
+from tests.testutils import generate_junction
 
+from buildstream.plugintestutils import create_repo, ALL_REPO_KINDS
 from buildstream.plugintestutils import cli  # pylint: disable=unused-import
 from buildstream import _yaml
 from buildstream._exceptions import ErrorDomain
diff --git a/tests/sources/generic/source_determinism.py b/tests/sources/generic/source_determinism.py
index 3488e3b..e3203a8 100644
--- a/tests/sources/generic/source_determinism.py
+++ b/tests/sources/generic/source_determinism.py
@@ -22,9 +22,9 @@
 import os
 import pytest
 
-from tests.testutils import create_repo, ALL_REPO_KINDS
 from tests.testutils.site import HAVE_SANDBOX
 
+from buildstream.plugintestutils import create_repo, ALL_REPO_KINDS
 from buildstream.plugintestutils import cli  # pylint: disable=unused-import
 from buildstream import _yaml
 
diff --git a/tests/sources/generic/track.py b/tests/sources/generic/track.py
index 4726a45..881046a 100644
--- a/tests/sources/generic/track.py
+++ b/tests/sources/generic/track.py
@@ -22,9 +22,10 @@
 import os
 import pytest
 
-from tests.testutils import create_repo, ALL_REPO_KINDS, generate_junction
+from tests.testutils import generate_junction
 from tests.frontend import configure_project
 
+from buildstream.plugintestutils import create_repo, ALL_REPO_KINDS
 from buildstream.plugintestutils import cli  # pylint: disable=unused-import
 from buildstream import _yaml
 from buildstream._exceptions import ErrorDomain
diff --git a/tests/sources/generic/track_cross_junction.py b/tests/sources/generic/track_cross_junction.py
index 5696961..7cf0496 100644
--- a/tests/sources/generic/track_cross_junction.py
+++ b/tests/sources/generic/track_cross_junction.py
@@ -22,8 +22,9 @@
 import os
 import pytest
 
-from tests.testutils import create_repo, ALL_REPO_KINDS, generate_junction
+from tests.testutils import generate_junction
 
+from buildstream.plugintestutils import create_repo, ALL_REPO_KINDS 
 from buildstream.plugintestutils import cli  # pylint: disable=unused-import
 from buildstream import _yaml
 
diff --git a/tests/sources/generic/workspace.py b/tests/sources/generic/workspace.py
index ad115c1..4da3a5b 100644
--- a/tests/sources/generic/workspace.py
+++ b/tests/sources/generic/workspace.py
@@ -23,8 +23,7 @@ import os
 import shutil
 import pytest
 
-from tests.testutils import create_repo, ALL_REPO_KINDS
-
+from buildstream.plugintestutils import create_repo, ALL_REPO_KINDS
 from buildstream.plugintestutils import cli  # pylint: disable=unused-import
 from buildstream import _yaml
 
diff --git a/tests/sources/git.py b/tests/sources/git.py
index 8922a47..d712c09 100644
--- a/tests/sources/git.py
+++ b/tests/sources/git.py
@@ -33,8 +33,8 @@ from buildstream._exceptions import ErrorDomain
 from buildstream import _yaml
 from buildstream.plugin import CoreWarnings
 from buildstream.plugintestutils import cli  # pylint: disable=unused-import
+from buildstream.plugintestutils import create_repo
 
-from tests.testutils import create_repo
 from tests.testutils.site import HAVE_GIT, HAVE_OLD_GIT
 
 DATA_DIR = os.path.join(
diff --git a/tests/sources/no_fetch_cached.py b/tests/sources/no_fetch_cached.py
index 767c193..4a3f719 100644
--- a/tests/sources/no_fetch_cached.py
+++ b/tests/sources/no_fetch_cached.py
@@ -7,7 +7,7 @@ import pytest
 from buildstream import _yaml
 
 from buildstream.plugintestutils import cli  # pylint: disable=unused-import
-from tests.testutils import create_repo
+from buildstream.plugintestutils import create_repo
 from tests.testutils.site import HAVE_GIT
 
 DATA_DIR = os.path.join(
diff --git a/tests/sources/ostree.py b/tests/sources/ostree.py
index 2d4dd95..e75a646 100644
--- a/tests/sources/ostree.py
+++ b/tests/sources/ostree.py
@@ -26,8 +26,7 @@ import pytest
 from buildstream._exceptions import ErrorDomain
 from buildstream import _yaml
 from buildstream.plugintestutils import cli  # pylint: disable=unused-import
-
-from tests.testutils import create_repo
+from buildstream.plugintestutils import create_repo
 
 DATA_DIR = os.path.join(
     os.path.dirname(os.path.realpath(__file__)),
diff --git a/tests/testutils/__init__.py b/tests/testutils/__init__.py
index 67378c9..438c55e 100644
--- a/tests/testutils/__init__.py
+++ b/tests/testutils/__init__.py
@@ -23,7 +23,6 @@
 #           William Salmon <wi...@codethink.co.uk>
 #
 
-from .repo import create_repo, ALL_REPO_KINDS
 from .artifactshare import create_artifact_share
 from .element_generators import create_element_size, update_element_size
 from .junction import generate_junction
diff --git a/tests/testutils/element_generators.py b/tests/testutils/element_generators.py
index 448c857..ec1b6bd 100644
--- a/tests/testutils/element_generators.py
+++ b/tests/testutils/element_generators.py
@@ -2,8 +2,7 @@ import os
 
 from buildstream import _yaml
 from buildstream import utils
-
-from . import create_repo
+from buildstream.plugintestutils import create_repo
 
 
 # create_element_size()
diff --git a/tests/testutils/junction.py b/tests/testutils/junction.py
index 01c76d1..5ddc8d0 100644
--- a/tests/testutils/junction.py
+++ b/tests/testutils/junction.py
@@ -1,4 +1,4 @@
-from tests.testutils import create_repo
+from buildstream.plugintestutils import create_repo
 from buildstream import _yaml
 
 
diff --git a/tests/testutils/repo/__init__.py b/tests/testutils/repo/__init__.py
index 1881aa3..e69de29 100644
--- a/tests/testutils/repo/__init__.py
+++ b/tests/testutils/repo/__init__.py
@@ -1,31 +0,0 @@
-from collections import OrderedDict
-
-from .git import Git
-from .bzr import Bzr
-from .ostree import OSTree
-from .tar import Tar
-from .zip import Zip
-
-ALL_REPO_KINDS = OrderedDict()
-ALL_REPO_KINDS['git'] = Git
-ALL_REPO_KINDS['bzr'] = Bzr
-ALL_REPO_KINDS['ostree'] = OSTree
-ALL_REPO_KINDS['tar'] = Tar
-ALL_REPO_KINDS['zip'] = Zip
-
-
-# create_repo()
-#
-# Convenience for creating a Repo
-#
-# Args:
-#    kind (str): The kind of repo to create (a source plugin basename)
-#    directory (str): The path where the repo will keep a cache
-#
-def create_repo(kind, directory, subdir='repo'):
-    try:
-        constructor = ALL_REPO_KINDS[kind]
-    except KeyError as e:
-        raise AssertionError("Unsupported repo kind {}".format(kind)) from e
-
-    return constructor(directory, subdir=subdir)
diff --git a/tests/testutils/repo/bzr.py b/tests/testutils/repo/bzr.py
index 0bedb3a..c006c3f 100644
--- a/tests/testutils/repo/bzr.py
+++ b/tests/testutils/repo/bzr.py
@@ -2,7 +2,7 @@ import os
 import subprocess
 import pytest
 
-from .repo import Repo
+from buildstream.plugintestutils import Repo
 from .. import site
 
 
diff --git a/tests/testutils/repo/git.py b/tests/testutils/repo/git.py
index 1455de2..5c27be3 100644
--- a/tests/testutils/repo/git.py
+++ b/tests/testutils/repo/git.py
@@ -4,7 +4,7 @@ import subprocess
 
 import pytest
 
-from .repo import Repo
+from buildstream.plugintestutils import Repo
 from .. import site
 
 
diff --git a/tests/testutils/repo/ostree.py b/tests/testutils/repo/ostree.py
index 0bb1d8a..d0cef8b 100644
--- a/tests/testutils/repo/ostree.py
+++ b/tests/testutils/repo/ostree.py
@@ -2,7 +2,7 @@ import subprocess
 
 import pytest
 
-from .repo import Repo
+from buildstream.plugintestutils import Repo
 from .. import site
 
 
diff --git a/tests/testutils/repo/repo.py b/tests/testutils/repo/repo.py
deleted file mode 100644
index 234aa37..0000000
--- a/tests/testutils/repo/repo.py
+++ /dev/null
@@ -1,90 +0,0 @@
-import os
-import shutil
-
-
-# Repo()
-#
-# Abstract class providing scaffolding for
-# generating data to be used with various sources
-#
-# Args:
-#    directory (str): The base temp directory for the test
-#    subdir (str): The subdir for the repo, in case there is more than one
-#
-class Repo():
-
-    def __init__(self, directory, subdir='repo'):
-
-        # The working directory for the repo object
-        #
-        self.directory = os.path.abspath(directory)
-
-        # The directory the actual repo will be stored in
-        self.repo = os.path.join(self.directory, subdir)
-
-        os.makedirs(self.repo, exist_ok=True)
-
-    # create():
-    #
-    # Create a repository in self.directory and add the initial content
-    #
-    # Args:
-    #    directory: A directory with content to commit
-    #
-    # Returns:
-    #    (smth): A new ref corresponding to this commit, which can
-    #            be passed as the ref in the Repo.source_config() API.
-    #
-    def create(self, directory):
-        pass
-
-    # source_config()
-    #
-    # Args:
-    #    ref (smth): An optional abstract ref object, usually a string.
-    #
-    # Returns:
-    #    (dict): A configuration which can be serialized as a
-    #            source when generating an element file on the fly
-    #
-    def source_config(self, ref=None):
-        pass
-
-    # copy_directory():
-    #
-    # Copies the content of src to the directory dest
-    #
-    # Like shutil.copytree(), except dest is expected
-    # to exist.
-    #
-    # Args:
-    #    src (str): The source directory
-    #    dest (str): The destination directory
-    #
-    def copy_directory(self, src, dest):
-        for filename in os.listdir(src):
-            src_path = os.path.join(src, filename)
-            dest_path = os.path.join(dest, filename)
-            if os.path.isdir(src_path):
-                shutil.copytree(src_path, dest_path)
-            else:
-                shutil.copy2(src_path, dest_path)
-
-    # copy():
-    #
-    # Creates a copy of this repository in the specified
-    # destination.
-    #
-    # Args:
-    #    dest (str): The destination directory
-    #
-    # Returns:
-    #    (Repo): A Repo object for the new repository.
-    def copy(self, dest):
-        subdir = self.repo[len(self.directory):].lstrip(os.sep)
-        new_dir = os.path.join(dest, subdir)
-        os.makedirs(new_dir, exist_ok=True)
-        self.copy_directory(self.repo, new_dir)
-        repo_type = type(self)
-        new_repo = repo_type(dest, subdir)
-        return new_repo
diff --git a/tests/testutils/repo/tar.py b/tests/testutils/repo/tar.py
index ee6cb77..6fdf58a 100644
--- a/tests/testutils/repo/tar.py
+++ b/tests/testutils/repo/tar.py
@@ -3,7 +3,7 @@ import tarfile
 
 from buildstream.utils import sha256sum
 
-from .repo import Repo
+from buildstream.plugintestutils import Repo
 
 
 class Tar(Repo):
diff --git a/tests/testutils/repo/zip.py b/tests/testutils/repo/zip.py
index 8133f12..c57e09e 100644
--- a/tests/testutils/repo/zip.py
+++ b/tests/testutils/repo/zip.py
@@ -3,7 +3,7 @@ import zipfile
 
 from buildstream.utils import sha256sum
 
-from .repo import Repo
+from buildstream.plugintestutils import Repo
 
 
 class Zip(Repo):


[buildstream] 08/11: fixup! fixup! fixup! fixup! Make templated source tests available in buildstream.plugintestutils

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

root pushed a commit to branch phil/remove-ostree-plugin
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 1ad1c41fe0b306ebfcf47fc10450becadf12b188
Author: Phil Dawson <ph...@codethink.co.uk>
AuthorDate: Wed Mar 27 16:19:32 2019 +0000

    fixup! fixup! fixup! fixup! Make templated source tests available in buildstream.plugintestutils
---
 MANIFEST.in | 2 ++
 setup.py    | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/MANIFEST.in b/MANIFEST.in
index a8899a9..b9f56e2 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -6,6 +6,8 @@ include MAINTAINERS
 include NEWS
 include README.rst
 
+recursive-include buildstream/plugintestutils/_sourcetests/project *
+
 # Documentation package includes
 include doc/Makefile
 include doc/badges.py
diff --git a/setup.py b/setup.py
index f9ed753..fb7e193 100755
--- a/setup.py
+++ b/setup.py
@@ -323,7 +323,7 @@ setup(name='BuildStream',
       packages=find_packages(exclude=('tests', 'tests.*')),
       package_data={'buildstream': ['plugins/*/*.py', 'plugins/*/*.yaml',
                                     'data/*.yaml', 'data/*.sh.in'],
-                    'buildstream.plugintestutils': ['_sourcetests/project']
+                    'buildstream.plugintestutils': ['_sourcetests/project/*']
       },
       include_package_data=True,
       data_files=[