#1401 tests: Patch time in CTS related tests
Merged 3 years ago by lsedlar. Opened 3 years ago by lsedlar.
lsedlar/pungi fix-tests  into  master

file modified
+2
@@ -593,6 +593,7 @@ 

          d = compose.mkdtemp(prefix="tweak_buildinstall")

          self.assertTrue(os.path.isdir(d))

  

+     @mock.patch("time.strftime", new=lambda fmt, time: "20200526")

      def test_get_compose_info(self):

          conf = ConfigWrapper(

              release_name="Test",
@@ -606,6 +607,7 @@ 

          ci_json = json.loads(ci.dumps())

          self.assertEqual(ci_json, self.ci_json)

  

+     @mock.patch("time.strftime", new=lambda fmt, time: "20200526")

      def test_get_compose_info_cts(self):

          conf = ConfigWrapper(

              release_name="Test",

The value must be fixed to match the expected JSON.

At other similar cases in code, 'new' is used with lambda:

new=lambda fmt, time: "20200526"

But it looks it works without it anyway.

That's a good point. I never remember the arguments for patch, and this worked. But I'll update to use the keyword before merging.

rebased onto d6caf07

3 years ago

Pull-Request has been merged by lsedlar

3 years ago