summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Dawson <phil.dawson@codethink.co.uk>2019-03-26 09:49:17 +0000
committerPhil Dawson <phil.dawson@codethink.co.uk>2019-04-12 16:06:19 +0100
commit16a28c0316a64189cb8c396c43b570764a83d33b (patch)
treeb0cf6a513b6f3da080fc5f5563625e624f0548d1
parentc30f4a56e1f802f338e4b248b2ba925e479d3418 (diff)
downloadbuildstream-16a28c0316a64189cb8c396c43b570764a83d33b.tar.gz
Make templated source tests available in buildstream.plugintestutils
-rw-r--r--MANIFEST.in3
-rw-r--r--buildstream/plugintestutils/__init__.py5
-rw-r--r--buildstream/plugintestutils/_sourcetests/__init__.py (renamed from tests/sources/generic/__init__.py)0
-rw-r--r--buildstream/plugintestutils/_sourcetests/build_checkout.py (renamed from tests/sources/generic/build_checkout.py)0
-rw-r--r--buildstream/plugintestutils/_sourcetests/fetch.py (renamed from tests/sources/generic/fetch.py)9
-rw-r--r--buildstream/plugintestutils/_sourcetests/mirror.py (renamed from tests/sources/generic/mirror.py)7
-rw-r--r--buildstream/plugintestutils/_sourcetests/project/elements/base.bst (renamed from tests/sources/generic/project/elements/base.bst)0
-rw-r--r--buildstream/plugintestutils/_sourcetests/project/elements/base/base-alpine.bst (renamed from tests/sources/generic/project/elements/base/base-alpine.bst)0
-rw-r--r--buildstream/plugintestutils/_sourcetests/project/elements/import-bin.bst (renamed from tests/sources/generic/project/elements/import-bin.bst)0
-rw-r--r--buildstream/plugintestutils/_sourcetests/project/elements/import-dev.bst (renamed from tests/sources/generic/project/elements/import-dev.bst)0
-rw-r--r--buildstream/plugintestutils/_sourcetests/project/elements/multiple_targets/dependency/horsey.bst (renamed from tests/sources/generic/project/elements/multiple_targets/dependency/horsey.bst)0
-rw-r--r--buildstream/plugintestutils/_sourcetests/project/elements/multiple_targets/dependency/pony.bst (renamed from tests/sources/generic/project/elements/multiple_targets/dependency/pony.bst)0
-rw-r--r--buildstream/plugintestutils/_sourcetests/project/elements/multiple_targets/dependency/zebry.bst (renamed from tests/sources/generic/project/elements/multiple_targets/dependency/zebry.bst)0
-rw-r--r--buildstream/plugintestutils/_sourcetests/project/elements/multiple_targets/order/0.bst (renamed from tests/sources/generic/project/elements/multiple_targets/order/0.bst)0
-rw-r--r--buildstream/plugintestutils/_sourcetests/project/elements/multiple_targets/order/1.bst (renamed from tests/sources/generic/project/elements/multiple_targets/order/1.bst)0
-rw-r--r--buildstream/plugintestutils/_sourcetests/project/elements/multiple_targets/order/2.bst (renamed from tests/sources/generic/project/elements/multiple_targets/order/2.bst)0
-rw-r--r--buildstream/plugintestutils/_sourcetests/project/elements/multiple_targets/order/3.bst (renamed from tests/sources/generic/project/elements/multiple_targets/order/3.bst)0
-rw-r--r--buildstream/plugintestutils/_sourcetests/project/elements/multiple_targets/order/4.bst (renamed from tests/sources/generic/project/elements/multiple_targets/order/4.bst)0
-rw-r--r--buildstream/plugintestutils/_sourcetests/project/elements/multiple_targets/order/5.bst (renamed from tests/sources/generic/project/elements/multiple_targets/order/5.bst)0
-rw-r--r--buildstream/plugintestutils/_sourcetests/project/elements/multiple_targets/order/6.bst (renamed from tests/sources/generic/project/elements/multiple_targets/order/6.bst)0
-rw-r--r--buildstream/plugintestutils/_sourcetests/project/elements/multiple_targets/order/7.bst (renamed from tests/sources/generic/project/elements/multiple_targets/order/7.bst)0
-rw-r--r--buildstream/plugintestutils/_sourcetests/project/elements/multiple_targets/order/8.bst (renamed from tests/sources/generic/project/elements/multiple_targets/order/8.bst)0
-rw-r--r--buildstream/plugintestutils/_sourcetests/project/elements/multiple_targets/order/9.bst (renamed from tests/sources/generic/project/elements/multiple_targets/order/9.bst)0
-rw-r--r--buildstream/plugintestutils/_sourcetests/project/elements/multiple_targets/order/run.bst (renamed from tests/sources/generic/project/elements/multiple_targets/order/run.bst)0
-rw-r--r--buildstream/plugintestutils/_sourcetests/project/files/bar (renamed from tests/sources/generic/project/files/bar)0
-rwxr-xr-xbuildstream/plugintestutils/_sourcetests/project/files/bin-files/usr/bin/hello (renamed from tests/sources/generic/project/files/bin-files/usr/bin/hello)0
-rw-r--r--buildstream/plugintestutils/_sourcetests/project/files/dev-files/usr/include/pony.h (renamed from tests/sources/generic/project/files/dev-files/usr/include/pony.h)0
-rw-r--r--buildstream/plugintestutils/_sourcetests/project/files/etc-files/etc/buildstream/config (renamed from tests/sources/generic/project/files/etc-files/etc/buildstream/config)0
-rw-r--r--buildstream/plugintestutils/_sourcetests/project/files/foo (renamed from tests/sources/generic/project/files/foo)0
-rw-r--r--buildstream/plugintestutils/_sourcetests/project/files/source-bundle/llamas.txt (renamed from tests/sources/generic/project/files/source-bundle/llamas.txt)0
-rw-r--r--buildstream/plugintestutils/_sourcetests/project/files/sub-project/elements/import-etc.bst (renamed from tests/sources/generic/project/files/sub-project/elements/import-etc.bst)0
-rw-r--r--buildstream/plugintestutils/_sourcetests/project/files/sub-project/files/etc-files/etc/animal.conf (renamed from tests/sources/generic/project/files/sub-project/files/etc-files/etc/animal.conf)0
-rw-r--r--buildstream/plugintestutils/_sourcetests/project/files/sub-project/project.conf (renamed from tests/sources/generic/project/files/sub-project/project.conf)0
-rw-r--r--buildstream/plugintestutils/_sourcetests/project/project.conf (renamed from tests/sources/generic/project/project.conf)0
-rw-r--r--buildstream/plugintestutils/_sourcetests/source_determinism.py (renamed from tests/sources/generic/source_determinism.py)7
-rw-r--r--buildstream/plugintestutils/_sourcetests/track.py (renamed from tests/sources/generic/track.py)9
-rw-r--r--buildstream/plugintestutils/_sourcetests/track_cross_junction.py (renamed from tests/sources/generic/track_cross_junction.py)7
-rw-r--r--buildstream/plugintestutils/_sourcetests/workspace.py (renamed from tests/sources/generic/workspace.py)4
-rw-r--r--buildstream/plugintestutils/_utils/__init__.py9
-rw-r--r--buildstream/plugintestutils/_utils/junction.py4
-rwxr-xr-xsetup.py1
-rwxr-xr-xtests/conftest.py25
-rw-r--r--tests/sources/__init__.py13
43 files changed, 60 insertions, 43 deletions
diff --git a/MANIFEST.in b/MANIFEST.in
index a8899a91e..4365f0df1 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -6,6 +6,9 @@ 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
include doc/Makefile
include doc/badges.py
diff --git a/buildstream/plugintestutils/__init__.py b/buildstream/plugintestutils/__init__.py
index a052e4780..728a1fcce 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
@@ -89,5 +90,5 @@ def sourcetests_collection_hook(session):
# 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.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
index e69de29bb..e69de29bb 100644
--- a/tests/sources/generic/__init__.py
+++ b/buildstream/plugintestutils/_sourcetests/__init__.py
diff --git a/tests/sources/generic/build_checkout.py b/buildstream/plugintestutils/_sourcetests/build_checkout.py
index 074be8429..074be8429 100644
--- a/tests/sources/generic/build_checkout.py
+++ b/buildstream/plugintestutils/_sourcetests/build_checkout.py
diff --git a/tests/sources/generic/fetch.py b/buildstream/plugintestutils/_sourcetests/fetch.py
index 52c853398..aaf92a14d 100644
--- a/tests/sources/generic/fetch.py
+++ b/buildstream/plugintestutils/_sourcetests/fetch.py
@@ -22,13 +22,10 @@
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, configure_project
+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/mirror.py b/buildstream/plugintestutils/_sourcetests/mirror.py
index 5315d184f..d682bb2ef 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
index 428afa736..428afa736 100644
--- a/tests/sources/generic/project/elements/base.bst
+++ b/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
index c5833095d..c5833095d 100644
--- a/tests/sources/generic/project/elements/base/base-alpine.bst
+++ b/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
index a847c0c23..a847c0c23 100644
--- a/tests/sources/generic/project/elements/import-bin.bst
+++ b/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
index 152a54667..152a54667 100644
--- a/tests/sources/generic/project/elements/import-dev.bst
+++ b/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
index bd1ffae9c..bd1ffae9c 100644
--- a/tests/sources/generic/project/elements/multiple_targets/dependency/horsey.bst
+++ b/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
index 3c29b4ea1..3c29b4ea1 100644
--- a/tests/sources/generic/project/elements/multiple_targets/dependency/pony.bst
+++ b/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
index 98447ab52..98447ab52 100644
--- a/tests/sources/generic/project/elements/multiple_targets/dependency/zebry.bst
+++ b/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
index a99be06a0..a99be06a0 100644
--- a/tests/sources/generic/project/elements/multiple_targets/order/0.bst
+++ b/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
index 82b507a62..82b507a62 100644
--- a/tests/sources/generic/project/elements/multiple_targets/order/1.bst
+++ b/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
index ee1afae20..ee1afae20 100644
--- a/tests/sources/generic/project/elements/multiple_targets/order/2.bst
+++ b/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
index 4c3a23dab..4c3a23dab 100644
--- a/tests/sources/generic/project/elements/multiple_targets/order/3.bst
+++ b/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
index b663a0b52..b663a0b52 100644
--- a/tests/sources/generic/project/elements/multiple_targets/order/4.bst
+++ b/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
index b9efcf71b..b9efcf71b 100644
--- a/tests/sources/generic/project/elements/multiple_targets/order/5.bst
+++ b/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
index 6c19d04e3..6c19d04e3 100644
--- a/tests/sources/generic/project/elements/multiple_targets/order/6.bst
+++ b/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
index 6805b3e6d..6805b3e6d 100644
--- a/tests/sources/generic/project/elements/multiple_targets/order/7.bst
+++ b/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
index b8d8964a0..b8d8964a0 100644
--- a/tests/sources/generic/project/elements/multiple_targets/order/8.bst
+++ b/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
index cc13bf3f0..cc13bf3f0 100644
--- a/tests/sources/generic/project/elements/multiple_targets/order/9.bst
+++ b/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
index 9b3d2446c..9b3d2446c 100644
--- a/tests/sources/generic/project/elements/multiple_targets/order/run.bst
+++ b/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
index e69de29bb..e69de29bb 100644
--- a/tests/sources/generic/project/files/bar
+++ b/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
index f534a4083..f534a4083 100755
--- a/tests/sources/generic/project/files/bin-files/usr/bin/hello
+++ b/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
index 40bd0c2e7..40bd0c2e7 100644
--- a/tests/sources/generic/project/files/dev-files/usr/include/pony.h
+++ b/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
index 04204c7c9..04204c7c9 100644
--- a/tests/sources/generic/project/files/etc-files/etc/buildstream/config
+++ b/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
index e69de29bb..e69de29bb 100644
--- a/tests/sources/generic/project/files/foo
+++ b/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
index f98b24871..f98b24871 100644
--- a/tests/sources/generic/project/files/source-bundle/llamas.txt
+++ b/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
index f0171990e..f0171990e 100644
--- a/tests/sources/generic/project/files/sub-project/elements/import-etc.bst
+++ b/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
index db8c36cba..db8c36cba 100644
--- 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
diff --git a/tests/sources/generic/project/files/sub-project/project.conf b/buildstream/plugintestutils/_sourcetests/project/files/sub-project/project.conf
index bbb8414a3..bbb8414a3 100644
--- a/tests/sources/generic/project/files/sub-project/project.conf
+++ b/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
index 05b68bfeb..05b68bfeb 100644
--- a/tests/sources/generic/project/project.conf
+++ b/buildstream/plugintestutils/_sourcetests/project/project.conf
diff --git a/tests/sources/generic/source_determinism.py b/buildstream/plugintestutils/_sourcetests/source_determinism.py
index bd83da007..8597a7072 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
index 334a8f679..668ea29e5 100644
--- a/tests/sources/generic/track.py
+++ b/buildstream/plugintestutils/_sourcetests/track.py
@@ -22,14 +22,11 @@
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, configure_project
+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_cross_junction.py b/buildstream/plugintestutils/_sourcetests/track_cross_junction.py
index 68db91756..ece3e0b8f 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
index 4da3a5b78..5218f8f1e 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/__init__.py b/buildstream/plugintestutils/_utils/__init__.py
index 5938e6a5e..b419d72b7 100644
--- a/buildstream/plugintestutils/_utils/__init__.py
+++ b/buildstream/plugintestutils/_utils/__init__.py
@@ -1 +1,10 @@
+import os
+
+from buildstream import _yaml
from .junction import generate_junction
+
+
+def configure_project(path, config):
+ config['name'] = 'test'
+ config['element-path'] = 'elements'
+ _yaml.dump(config, os.path.join(path, 'project.conf'))
diff --git a/buildstream/plugintestutils/_utils/junction.py b/buildstream/plugintestutils/_utils/junction.py
index 530a191ac..ca059eb8b 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/setup.py b/setup.py
index 49b115453..0154b4ec5 100755
--- a/setup.py
+++ b/setup.py
@@ -323,6 +323,7 @@ setup(name='BuildStream',
packages=find_packages(exclude=('tests', 'tests.*')),
package_data={'buildstream': ['plugins/*/*.py', 'plugins/*/*.yaml',
'data/*.yaml', 'data/*.sh.in']},
+ 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
diff --git a/tests/conftest.py b/tests/conftest.py
index 30577870f..fefd2f755 100755
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -1,6 +1,7 @@
#!/usr/bin/env python3
#
# Copyright (C) 2018 Codethink Limited
+# Copyright (C) 2019 Bloomberg Finance LLP
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -23,6 +24,14 @@ import shutil
import tempfile
import pytest
from buildstream._platform.platform import Platform
+from buildstream.plugintestutils import register_repo_kind, sourcetests_collection_hook
+
+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
+
#
# This file is loaded by pytest, we use it to add a custom
@@ -155,3 +164,19 @@ def clean_platform_cache():
@pytest.fixture(autouse=True)
def ensure_platform_cache_is_clean():
clean_platform_cache()
+
+
+#################################################
+# Setup for templated source tests #
+#################################################
+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)
+
+
+# This hook enables pytest to collect the templated source tests from
+# buildstream.plugintestutils
+def pytest_sessionstart(session):
+ sourcetests_collection_hook(session)
diff --git a/tests/sources/__init__.py b/tests/sources/__init__.py
index 155ecc064..02a755074 100644
--- a/tests/sources/__init__.py
+++ b/tests/sources/__init__.py
@@ -1,18 +1,5 @@
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()