#255 Fix issue when check_deps is not bool but int which breaks Pungi.
Merged 5 months ago by jkaluza. Opened 5 months ago by jkaluza.
jkaluza/odcs check-deps-bool  into  master

file modified
+1 -1

@@ -168,7 +168,7 @@ 

          else:

              raise ValueError("Unknown source_type %r" % source_type)

  

-         self.check_deps = flags & COMPOSE_FLAGS["check_deps"]

+         self.check_deps = bool(flags & COMPOSE_FLAGS["check_deps"])

  

      @property

      def source_type_str(self):

file modified
+2 -2

@@ -168,13 +168,13 @@ 

  

              template = pungi_cfg.get_pungi_config()

              cfg = self._load_pungi_cfg(template)

-             self.assertFalse(cfg["check_deps"])

+             self.assertIs(cfg["check_deps"], False)

  

              pungi_cfg = PungiConfig("MBS-512", "1", PungiSourceType.KOJI_TAG,

                                      "f26", flags=COMPOSE_FLAGS["check_deps"])

              template = pungi_cfg.get_pungi_config()

              cfg = self._load_pungi_cfg(template)

-             self.assertTrue(cfg["check_deps"])

+             self.assertIs(cfg["check_deps"], True)

  

      def test_get_pungi_conf_multilib(self):

          _, mock_path = tempfile.mkstemp()

When check_deps is flag is set, the flags & COMPOSE_FLAGS["check_deps"] evaluates to 8, while we need it to be a True.

Looks good. Just a minor note: assertEqual(0, False) actually passes, it does not enforce the types to be same. Also assertEqual(1, True) does not report any issues. assertEqual(8, True) does not pass (at least with python 2.7).

rebased onto d97db45

5 months ago

I use assertIs now which is type aware.

Pull-Request has been merged by jkaluza

5 months ago