Debian Codegraph @

testsuite/symlink-ignore_test.py

raw symbols SCIP
1 #!/usr/bin/env python3
2 # Python rewrite of testsuite/symlink-ignore.test.
3 #
4 # Default behaviour: without -l, -L or -a, rsync should NOT copy any
5 # symlinks. The referent file should land in the destination but every
6 # symlink in the source must be absent.
7
8 from rsyncfns import (
9 FROMDIR, TODIR,
10 build_symlinks, is_a_link, run_rsync, test_fail,
11 )
12
13
14 build_symlinks()
15
16 # Copy recursively, but without -l or -L or -a, so symlinks should be missing.
17 run_rsync('-r', f'{FROMDIR}/', str(TODIR))
18
19 if not (TODIR / 'referent').is_file():
20 test_fail("referent was not copied")
21 if (TODIR / 'from').is_dir():
22 test_fail("extra level of directories")
23 if is_a_link(TODIR / 'dangling'):
24 test_fail("dangling symlink was copied")
25 if is_a_link(TODIR / 'relative'):
26 test_fail("relative symlink was copied")
27 if is_a_link(TODIR / 'absolute'):
28 test_fail("absolute symlink was copied")