File tree 2 files changed +13
-0
lines changed
2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -231,6 +231,7 @@ def __enter__(self):
231
231
self .old_metadata = _read_or_empty (self .metadata_file_path )
232
232
_add_self_git_source ()
233
233
watch_dir = pathlib .Path (self .metadata_file_path ).parent
234
+ os .makedirs (watch_dir , exist_ok = True )
234
235
self .handler = FileSystemEventHandler (watch_dir )
235
236
self .observer = watchdog .observers .Observer ()
236
237
self .observer .schedule (self .handler , str (watch_dir ), recursive = True )
Original file line number Diff line number Diff line change @@ -417,3 +417,15 @@ def test_disable_writing_metadata(source_tree: SourceTree):
417
417
assert not metadata_path .exists ()
418
418
finally :
419
419
metadata .enable_write_metadata (True )
420
+
421
+
422
+ def test_watch_dir_does_not_exist_yet (source_tree ):
423
+ new_dir_path = source_tree .tmpdir / "blahblah"
424
+ metadata_path = new_dir_path / "synth.metadata"
425
+
426
+ assert not os .path .exists (new_dir_path )
427
+
428
+ with metadata .MetadataTrackerAndWriter (metadata_path ):
429
+ pass
430
+
431
+ assert os .path .exists (new_dir_path )
You can’t perform that action at this time.
0 commit comments