Skip to content

Commit

Permalink
test for don't kill if pid same as file (celery#8997)
Browse files Browse the repository at this point in the history
  • Loading branch information
lewijw committed May 2, 2024
1 parent 665def8 commit 6035036
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions t/unit/utils/test_platforms.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,15 @@ def test_remove_if_stale_no_pidfile(self):
assert p.remove_if_stale()
p.remove.assert_called_with()

def test_remove_if_stale_same_pid(self):
p = Pidfile('/var/pid')
p.read_pid = Mock()
p.read_pid.return_value = os.getpid()
p.remove = Mock()

assert p.remove_if_stale()
p.remove.assert_not_called()

@patch('os.fsync')
@patch('os.getpid')
@patch('os.open')
Expand Down

0 comments on commit 6035036

Please sign in to comment.