From 126cf1128ca9a632fb882097730333d39418741a Mon Sep 17 00:00:00 2001 From: jonathanmetzman <31354670+jonathanmetzman@users.noreply.github.com> Date: Wed, 5 Jan 2022 15:00:00 -0500 Subject: [PATCH] [infra] Fix test failure. (#7098) * [infra] Fix test failure. Make sure to mock current datetime so that tests don't break each year. * lnt --- infra/helper_test.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/infra/helper_test.py b/infra/helper_test.py index 951eba47a..8430c94fa 100644 --- a/infra/helper_test.py +++ b/infra/helper_test.py @@ -112,6 +112,7 @@ class GenerateImplTest(fake_filesystem_unittest.TestCase): PROJECT_LANGUAGE = 'python' def setUp(self): + self.maxDiff = None # pylint: disable=invalid-name self.setUpPyfakefs() self.fs.add_real_directory(helper.OSS_FUZZ_DIR) @@ -150,7 +151,9 @@ class GenerateImplTest(fake_filesystem_unittest.TestCase): self._verify_templated_files(templates.EXTERNAL_TEMPLATES, build_integration_path, self.PROJECT_LANGUAGE) - def test_generate_swift_project(self): + @mock.patch('helper._get_current_datetime', + return_value=datetime.datetime(year=2021, month=1, day=1)) + def test_generate_swift_project(self, _): """Tests that the swift project uses the correct base image.""" helper._generate_impl(helper.Project(self.PROJECT_NAME), 'swift') self._verify_templated_files(