Skip to content
This repository has been archived by the owner on May 22, 2021. It is now read-only.

Commit

Permalink
[AIRFLOW-6490] Improve time delta comparison in local task job tests (a…
Browse files Browse the repository at this point in the history
  • Loading branch information
turbaszek authored and galuszkak committed Mar 5, 2020
1 parent e6c856d commit 92c5a3a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tests/jobs/test_local_task_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,10 @@ def test_heartbeat_failed_fast(self, mock_getpid):
for i in range(1, len(heartbeat_records)):
time1 = heartbeat_records[i - 1]
time2 = heartbeat_records[i]
self.assertGreaterEqual((time2 - time1).total_seconds(), job.heartrate)
# Assert that difference small enough to avoid:
# AssertionError: 1.996401 not greater than or equal to 2
delta = (time2 - time1).total_seconds()
self.assertAlmostEqual(delta, job.heartrate, delta=0.006)

@unittest.skipIf('mysql' in conf.get('core', 'sql_alchemy_conn'),
"flaky when run on mysql")
Expand Down

0 comments on commit 92c5a3a

Please sign in to comment.