From 6acea68b0cb78897b8f65aa1cc922145751563f4 Mon Sep 17 00:00:00 2001 From: Neil Wu <602725+nwu63@users.noreply.github.com> Date: Thu, 4 May 2023 20:22:05 -0400 Subject: [PATCH] Remove flaky tests (#342) * remove flaky timing-based test * skip multiobjective NSGA2 tests * skip only the n_obj=2 test --- tests/test_nsga2_multi_objective.py | 2 ++ tests/testing_utils.py | 3 --- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/test_nsga2_multi_objective.py b/tests/test_nsga2_multi_objective.py index 37c4016c..0fe7f57a 100644 --- a/tests/test_nsga2_multi_objective.py +++ b/tests/test_nsga2_multi_objective.py @@ -45,6 +45,8 @@ def setup_optProb(self, n_obj): @parameterized.expand([(1,), (2,)]) def test_opt(self, n_obj): + if n_obj == 2: + raise unittest.SkipTest("skip flaky NSGA2 tests") self.setup_optProb(n_obj) # 300 generations will find x=(0,0), 200 or less will find x=(1,1) diff --git a/tests/testing_utils.py b/tests/testing_utils.py index 21ef383f..b0bccd73 100644 --- a/tests/testing_utils.py +++ b/tests/testing_utils.py @@ -326,9 +326,6 @@ def check_hist_file(self, tol): times = hist.getValues(names="time", major=False)["time"] # the times should be monotonically increasing self.assertTrue(np.all(np.diff(times) > 0)) - # the final time should be close to the metadata time - # we only specify a relatively loose atol because of variations in overhead cost between machines - assert_allclose(times[-1], metadata["optTime"], atol=1.0) # this check is only used for optimizers that guarantee '0' and 'last' contain funcs if self.optName in ["SNOPT", "PSQP"]: