Fixed bug that caused vigil not to restart if the root directory was renamed.
This commit is contained in:
parent
61efffa0b7
commit
17516cd831
3 changed files with 28 additions and 18 deletions
4
BUGS
4
BUGS
|
|
@ -3,8 +3,6 @@ Current
|
||||||
e.g. vigil.py pylint, BUGS metadata, BUGS _pygments
|
e.g. vigil.py pylint, BUGS metadata, BUGS _pygments
|
||||||
- Scrolling in the help screen doesn't work with the arrow keys.
|
- Scrolling in the help screen doesn't work with the arrow keys.
|
||||||
- Within the sandbox sudo is not working for tools.
|
- Within the sandbox sudo is not working for tools.
|
||||||
- The cache is not relocatable anymore. i.e. Restarting vigil after renaming
|
|
||||||
the project directory is failing.
|
|
||||||
|
|
||||||
|
|
||||||
Current (tool related)
|
Current (tool related)
|
||||||
|
|
@ -209,6 +207,8 @@ Fixed
|
||||||
- There is an exception if vigil's window is made too small.
|
- There is an exception if vigil's window is made too small.
|
||||||
<- When the window is narrower than 10 or shorter than 20 the contents
|
<- When the window is narrower than 10 or shorter than 20 the contents
|
||||||
start to crop instead of shrink.
|
start to crop instead of shrink.
|
||||||
|
- The cache is not relocatable anymore. i.e. Restarting vigil after renaming
|
||||||
|
the project directory is failing.
|
||||||
|
|
||||||
|
|
||||||
Won't fix
|
Won't fix
|
||||||
|
|
|
||||||
14
vigil
14
vigil
|
|
@ -872,7 +872,9 @@ def add_watch_manager_to_mainloop(root_path, mainloop, on_filesystem_change,
|
||||||
notifier.read_events()
|
notifier.read_events()
|
||||||
notifier.process_events()
|
notifier.process_events()
|
||||||
on_filesystem_change()
|
on_filesystem_change()
|
||||||
mainloop.add_reader(watch_manager.get_fd(), on_inotify)
|
watch_manager_fd = watch_manager.get_fd()
|
||||||
|
mainloop.add_reader(watch_manager_fd, on_inotify)
|
||||||
|
return watch_manager_fd
|
||||||
|
|
||||||
|
|
||||||
_UPDATE_THREAD_STOPPED = False
|
_UPDATE_THREAD_STOPPED = False
|
||||||
|
|
@ -906,18 +908,19 @@ def main(root_path, is_being_tested=False):
|
||||||
summary = screen._summary
|
summary = screen._summary
|
||||||
summary._lock = threading.Lock()
|
summary._lock = threading.Lock()
|
||||||
summary._jobs_added_event = jobs_added_event
|
summary._jobs_added_event = jobs_added_event
|
||||||
|
summary._root_path = root_path
|
||||||
log = screen._log
|
log = screen._log
|
||||||
log._appearance_changed_event = appearance_changed_event
|
log._appearance_changed_event = appearance_changed_event
|
||||||
summary.sync_with_filesystem()
|
summary.sync_with_filesystem()
|
||||||
|
|
||||||
|
log.log_message("Program started.")
|
||||||
|
jobs_added_event.set()
|
||||||
def on_filesystem_change():
|
def on_filesystem_change():
|
||||||
log.log_message("Filesystem changed.")
|
log.log_message("Filesystem changed.")
|
||||||
summary.sync_with_filesystem()
|
summary.sync_with_filesystem()
|
||||||
appearance_changed_event.set()
|
appearance_changed_event.set()
|
||||||
add_watch_manager_to_mainloop(root_path, loop, on_filesystem_change,
|
watch_manager_fd = add_watch_manager_to_mainloop(
|
||||||
is_path_excluded)
|
root_path, loop, on_filesystem_change, is_path_excluded)
|
||||||
log.log_message("Program started.")
|
|
||||||
jobs_added_event.set()
|
|
||||||
runners = []
|
runners = []
|
||||||
sandbox_temp_dir = tempfile.mkdtemp()
|
sandbox_temp_dir = tempfile.mkdtemp()
|
||||||
sandbox = sandbox_fs.SandboxFs(sandbox_temp_dir)
|
sandbox = sandbox_fs.SandboxFs(sandbox_temp_dir)
|
||||||
|
|
@ -973,6 +976,7 @@ def main(root_path, is_being_tested=False):
|
||||||
finally:
|
finally:
|
||||||
sandbox.umount()
|
sandbox.umount()
|
||||||
os.rmdir(sandbox_temp_dir)
|
os.rmdir(sandbox_temp_dir)
|
||||||
|
loop.remove_reader(watch_manager_fd)
|
||||||
|
|
||||||
|
|
||||||
@contextlib.contextmanager
|
@contextlib.contextmanager
|
||||||
|
|
|
||||||
|
|
@ -234,23 +234,29 @@ def _tmp_total():
|
||||||
|
|
||||||
class MainTestCase(unittest.TestCase):
|
class MainTestCase(unittest.TestCase):
|
||||||
|
|
||||||
def test_start_and_run_a_job_then_stop_with_no_leaks(self):
|
def test_main_and_restart_and_no_leaks_and_is_relocatable(self):
|
||||||
temp_dir = tempfile.mkdtemp()
|
def test_run(root_path):
|
||||||
try:
|
|
||||||
mount_total = _mount_total()
|
mount_total = _mount_total()
|
||||||
tmp_total = _tmp_total()
|
tmp_total = _tmp_total()
|
||||||
foo_path = os.path.join(temp_dir, "foo")
|
foo_path = os.path.join(root_path, "foo")
|
||||||
open(foo_path, "w").close()
|
open(foo_path, "w").close()
|
||||||
vigil.manage_cache(temp_dir)
|
vigil.manage_cache(root_path)
|
||||||
with vigil.chdir(temp_dir):
|
with vigil.chdir(root_path):
|
||||||
with contextlib.redirect_stdout(io.StringIO()):
|
with contextlib.redirect_stdout(io.StringIO()):
|
||||||
vigil.main(temp_dir, is_being_tested=True)
|
vigil.main(root_path, is_being_tested=True)
|
||||||
self.assertTrue(os.path.exists(".vigil/.summary.pickle"))
|
for file_name in [".summary.pickle", ".creation-time", ".log",
|
||||||
self.assertTrue(os.path.exists(".vigil/.creation-time"))
|
"foo-metadata"]:
|
||||||
self.assertTrue(os.path.exists(".vigil/.log"))
|
self.assertTrue(os.path.exists(".vigil/" + file_name))
|
||||||
self.assertTrue(os.path.exists(".vigil/foo-metadata"))
|
|
||||||
self.assertEqual(_mount_total(), mount_total)
|
self.assertEqual(_mount_total(), mount_total)
|
||||||
self.assertEqual(_tmp_total(), tmp_total)
|
self.assertEqual(_tmp_total(), tmp_total)
|
||||||
|
temp_dir = tempfile.mkdtemp()
|
||||||
|
try:
|
||||||
|
first_dir = os.path.join(temp_dir, "first")
|
||||||
|
os.mkdir(first_dir)
|
||||||
|
test_run(first_dir)
|
||||||
|
second_dir = os.path.join(temp_dir, "second")
|
||||||
|
os.rename(first_dir, second_dir)
|
||||||
|
test_run(second_dir)
|
||||||
finally:
|
finally:
|
||||||
shutil.rmtree(temp_dir)
|
shutil.rmtree(temp_dir)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue