def compare_root_paths(path1, path2): if not Config.general.new_file: bail_if_non_existing(path1, path2) if os.path.isdir(path1) and os.path.isdir(path2): return compare_directories(path1, path2) file1 = specialize(FilesystemFile(path1)) file2 = specialize(FilesystemFile(path2)) return compare_files(file1, file2)
def differences(tmpdir): tmpdir.mkdir('a') tmpdir.mkdir('a/dir') tmpdir.mkdir('b') tmpdir.mkdir('b/dir') shutil.copy(TEST_FILE1_PATH, str(tmpdir.join('a/dir/text'))) shutil.copy(TEST_FILE2_PATH, str(tmpdir.join('b/dir/text'))) os.utime(str(tmpdir.join('a/dir/text')), (0, 0)) os.utime(str(tmpdir.join('b/dir/text')), (0, 0)) return compare_directories(str(tmpdir.join('a')), str(tmpdir.join('b'))).details
def compare_root_paths(path1, path2): if not Config.general.new_file: bail_if_non_existing(path1, path2) if os.path.isdir(path1) and os.path.isdir(path2): return compare_directories(path1, path2) container1 = FilesystemDirectory(os.path.dirname(path1)).as_container file1 = specialize(FilesystemFile(path1, container=container1)) container2 = FilesystemDirectory(os.path.dirname(path2)).as_container file2 = specialize(FilesystemFile(path2, container=container2)) return compare_files(file1, file2)
def test_no_differences_with_extra_slash(): difference = compare_directories(os.path.dirname(__file__) + '/', os.path.dirname(__file__)) assert difference is None
def test_no_differences(): difference = compare_directories(os.path.dirname(__file__), os.path.dirname(__file__)) assert difference is None
def test_no_differences_with_extra_slash(): difference = compare_directories( os.path.dirname(__file__) + '/', os.path.dirname(__file__)) assert difference is None