Merge #1200 Fix the unit tests

This commit is contained in:
Jan Kaluža
2019-04-04 05:03:39 +00:00
5 changed files with 12 additions and 7 deletions

1
Vagrantfile vendored
View File

@@ -20,6 +20,7 @@ $script = <<SCRIPT
openssl-devel \
python \
python-devel \
python2-dnf \
python-docutils \
python-flask \
python-gobject-base \

View File

@@ -20,6 +20,7 @@ RUN yum -y install \
kobo-rpmlib \
libmodulemd \
python-backports-ssl_match_hostname \
python-dnf \
python-dogpile-cache \
python-enum34 \
python-flask \

View File

@@ -1,6 +1,8 @@
FROM fedora:29
WORKDIR /build
# Pin the version of libsolv until the following is in stable:
# https://bodhi.fedoraproject.org/updates/FEDORA-2019-c381c7bf54
RUN dnf -y install \
--nogpgcheck \
--setopt=deltarpm=0 \
@@ -13,6 +15,7 @@ RUN dnf -y install \
python3-rpm \
libmodulemd \
python3-gobject \
python3-dnf \
python3-dogpile-cache \
python3-flask \
python3-flask-migrate \
@@ -24,7 +27,8 @@ RUN dnf -y install \
python3-prometheus_client \
python3-requests \
python3-six \
python3-solv \
https://kojipkgs.fedoraproject.org//packages/libsolv/0.7.4/2.fc29/x86_64/libsolv-0.7.4-2.fc29.x86_64.rpm \
https://kojipkgs.fedoraproject.org//packages/libsolv/0.7.4/2.fc29/x86_64/python3-solv-0.7.4-2.fc29.x86_64.rpm \
python3-sqlalchemy \
python3-pungi \
# Test-only dependencies

View File

@@ -1254,10 +1254,8 @@ class TestOfflineLocalBuilds:
profiles = mmd.get_profiles()
assert set(profiles.keys()) == set(["buildroot", "srpm-buildroot"])
@patch("module_build_service.utils.general.open", create=True)
@patch("module_build_service.utils.general.open", create=True, new_callable=mock.mock_open)
def test_import_builds_from_local_dnf_repos(self, patched_open):
pytest.importorskip("dnf")
with patch("dnf.Base") as dnf_base:
repo = mock.MagicMock()
repo.repofile = "/etc/yum.repos.d/foo.repo"
@@ -1265,9 +1263,7 @@ class TestOfflineLocalBuilds:
repo.get_metadata_content.return_value = f.read()
base = dnf_base.return_value
base.repos = {"reponame": repo}
patched_open.return_value = mock.mock_open(
read_data="FOO=bar\nPLATFORM_ID=platform:x\n").return_value
patched_open.return_value.readlines.return_value = ('FOO=bar', 'PLATFORM_ID=platform:x')
module_build_service.utils.import_builds_from_local_dnf_repos()

View File

@@ -19,6 +19,9 @@ exclude =
[testenv]
usedevelop = true
sitepackages = true
whitelist_externals =
flake8
py.test-3
deps = -r{toxinidir}/test-requirements.txt
commands =
py.test -v \