Skip to content
Snippets Groups Projects
Commit 193bc3c1 authored by Tristan Van Berkom's avatar Tristan Van Berkom
Browse files

Restructuring tests using the Repo and Cli

Make all the test batteries which run on all the
source backends we have repo scaffoldings for discover
the list of Repo implementations automatically.
parent 60297032
No related branches found
No related tags found
No related merge requests found
import os
import pytest
from tests.testutils.runcli import cli
from tests.testutils.repo import create_repo
from tests.testutils import cli, create_repo, ALL_REPO_KINDS
from buildstream import _yaml
......@@ -37,7 +36,7 @@ def test_build_checkout(datafiles, cli):
@pytest.mark.datafiles(DATA_DIR)
@pytest.mark.parametrize("kind", [('git'), ('bzr'), ('ostree'), ('tar')])
@pytest.mark.parametrize("kind", [(kind) for kind in ALL_REPO_KINDS])
def test_fetch_build_checkout(cli, tmpdir, datafiles, kind):
checkout = os.path.join(cli.directory, 'checkout')
project = os.path.join(datafiles.dirname, datafiles.basename)
......
import os
import pytest
from tests.testutils.runcli import cli
from tests.testutils.repo import create_repo
from tests.testutils import cli, create_repo, ALL_REPO_KINDS
from buildstream import _yaml
# Project directory
DATA_DIR = os.path.join(
os.path.dirname(os.path.realpath(__file__)),
......@@ -14,7 +12,7 @@ DATA_DIR = os.path.join(
@pytest.mark.datafiles(DATA_DIR)
@pytest.mark.parametrize("kind", [('git'), ('bzr'), ('ostree'), ('tar')])
@pytest.mark.parametrize("kind", [(kind) for kind in ALL_REPO_KINDS])
def test_fetch(cli, tmpdir, datafiles, kind):
project = os.path.join(datafiles.dirname, datafiles.basename)
bin_files_path = os.path.join(project, 'files', 'bin-files')
......
import os
import pytest
from tests.testutils.runcli import cli
from tests.testutils.repo import create_repo
from tests.testutils import cli, create_repo, ALL_REPO_KINDS
from buildstream import _yaml
# Project directory
DATA_DIR = os.path.join(
os.path.dirname(os.path.realpath(__file__)),
......@@ -14,7 +12,7 @@ DATA_DIR = os.path.join(
@pytest.mark.datafiles(DATA_DIR)
@pytest.mark.parametrize("kind", [('git'), ('bzr'), ('ostree'), ('tar')])
@pytest.mark.parametrize("kind", [(kind) for kind in ALL_REPO_KINDS])
def test_track(cli, tmpdir, datafiles, kind):
project = os.path.join(datafiles.dirname, datafiles.basename)
dev_files_path = os.path.join(project, 'files', 'dev-files')
......
import os
import pytest
import shutil
from tests.testutils.runcli import cli
from tests.testutils.repo import create_repo
from tests.testutils import cli, create_repo, ALL_REPO_KINDS
from buildstream import _yaml
repo_kinds = [('git'), ('bzr'), ('ostree'), ('tar')]
repo_kinds = [(kind) for kind in ALL_REPO_KINDS]
# Project directory
DATA_DIR = os.path.join(
......@@ -161,7 +160,7 @@ def test_list(cli, tmpdir, datafiles, kind):
@pytest.mark.datafiles(DATA_DIR)
@pytest.mark.parametrize("kind", [('git'), ('bzr'), ('ostree'), ('tar')])
@pytest.mark.parametrize("kind", repo_kinds)
def test_build(cli, tmpdir, datafiles, kind):
element_name, project, workspace = open_workspace(cli, tmpdir, datafiles, kind, False)
checkout = os.path.join(str(tmpdir), 'checkout')
......
from .runcli import cli
from .repo import create_repo, ALL_REPO_KINDS
from collections import OrderedDict
import pytest
from .git import Git
from .bzr import Bzr
from .ostree import OSTree
from .tar import Tar
available_repos = {
'git': Git,
'bzr': Bzr,
'ostree': OSTree,
'tar': Tar
}
ALL_REPO_KINDS = OrderedDict()
ALL_REPO_KINDS['git'] = Git
ALL_REPO_KINDS['bzr'] = Bzr
ALL_REPO_KINDS['ostree'] = OSTree
ALL_REPO_KINDS['tar'] = Tar
# create_repo()
......@@ -22,7 +22,7 @@ available_repos = {
#
def create_repo(kind, directory):
try:
constructor = available_repos[kind]
constructor = ALL_REPO_KINDS[kind]
except KeyError as e:
raise AssertionError("Unsupported repo kind {}".format(kind)) from e
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment