sleep in the test

This commit is contained in:
Paul Gauthier 2023-10-18 12:15:11 -07:00
parent b87c9f14fb
commit 1a2370f9ae
2 changed files with 4 additions and 4 deletions

View file

@ -208,7 +208,6 @@ class GitRepo:
mtime = self.aider_ignore_file.stat().st_mtime mtime = self.aider_ignore_file.stat().st_mtime
dump(mtime) dump(mtime)
if mtime != self.aider_ignore_ts: if mtime != self.aider_ignore_ts:
self.aider_ignore_ts = mtime self.aider_ignore_ts = mtime
lines = self.aider_ignore_file.read_text().splitlines() lines = self.aider_ignore_file.read_text().splitlines()

View file

@ -1,5 +1,6 @@
import os import os
import tempfile import tempfile
import time
import unittest import unittest
from pathlib import Path from pathlib import Path
from unittest.mock import patch from unittest.mock import patch
@ -68,7 +69,6 @@ class TestRepo(unittest.TestCase):
git_repo = GitRepo(InputOutput(), None, ".") git_repo = GitRepo(InputOutput(), None, ".")
diffs = git_repo.diff_commits(False, "HEAD~1", "HEAD") diffs = git_repo.diff_commits(False, "HEAD~1", "HEAD")
dump(diffs)
self.assertIn("two", diffs) self.assertIn("two", diffs)
@patch("aider.repo.simple_send_with_retries") @patch("aider.repo.simple_send_with_retries")
@ -203,8 +203,10 @@ class TestRepo(unittest.TestCase):
self.assertIn(str(fname), fnames) self.assertIn(str(fname), fnames)
self.assertIn(str(fname2), fnames) self.assertIn(str(fname2), fnames)
# github actions don't seem to update the mtime?
time.sleep(1)
aiderignore.write_text("new.txt\n") aiderignore.write_text("new.txt\n")
dump(aiderignore.read_text())
# new.txt should be gone! # new.txt should be gone!
fnames = git_repo.get_tracked_files() fnames = git_repo.get_tracked_files()
@ -212,7 +214,6 @@ class TestRepo(unittest.TestCase):
self.assertIn(str(fname2), fnames) self.assertIn(str(fname2), fnames)
aiderignore.write_text("new2.txt\n") aiderignore.write_text("new2.txt\n")
dump(aiderignore.read_text())
# new2.txt should be gone! # new2.txt should be gone!
fnames = git_repo.get_tracked_files() fnames = git_repo.get_tracked_files()