#1200 Fix the unit tests
Merged 4 years ago by jkaluza. Opened 4 years ago by mprahl.

file modified
+1
@@ -20,6 +20,7 @@ 

          openssl-devel \

          python \

          python-devel \

+         python2-dnf \

          python-docutils \

          python-flask \

          python-gobject-base \

file modified
+1
@@ -20,6 +20,7 @@ 

      kobo-rpmlib \

      libmodulemd \

      python-backports-ssl_match_hostname \

+     python-dnf \

      python-dogpile-cache \

      python-enum34 \

      python-flask \

file modified
+5 -1
@@ -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 @@ 

      python3-rpm \

      libmodulemd \

      python3-gobject \

+     python3-dnf \

      python3-dogpile-cache \

      python3-flask \

      python3-flask-migrate \
@@ -24,7 +27,8 @@ 

      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

@@ -1254,10 +1254,8 @@ 

          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 @@ 

                  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()

  

file modified
+3
@@ -19,6 +19,9 @@ 

  [testenv]

  usedevelop = true

  sitepackages = true

+ whitelist_externals =

+     flake8

+     py.test-3

  deps = -r{toxinidir}/test-requirements.txt

  commands =

      py.test -v \

no initial comment

2 new commits added

  • Pin the version of libsolv in FEDORA-2019-c381c7bf54 for the tests
  • Whitelist flake8 in tox
4 years ago

1 new commit added

  • Whitelist py.test-3 in tox
4 years ago

Commit 9aae63f fixes this pull-request

Pull-Request has been merged by jkaluza

4 years ago

Pull-Request has been merged by jkaluza

4 years ago