testing.functional.test_selection module

class testing.functional.test_selection.IncludeExcludeFunctionalTest(methodName='runTest')[source]

Bases: FunctionalTestCase

This contains methods used in the tests below for testing the include, exclude and various filelist features.

complete_directory_tree = [['1', '2', '3', 'trailing_space ', '1.doc', '1.py'], ['1sub1', '1sub2', '1sub3'], ['1sub1sub1', '1sub1sub2', '1sub1sub3'], ['1sub1sub1_file.txt'], ['1sub1sub2_file.txt'], ['1sub1sub3_file.txt'], ['1sub2sub1', '1sub2sub2', '1sub2sub3'], ['1sub3sub1', '1sub3sub2', '1sub3sub3'], ['2sub1', '2sub2', '2sub3'], ['2sub1sub1', '2sub1sub2', '2sub1sub3'], ['2sub1sub1_file.txt'], ['2sub2sub1', '2sub2sub2', '2sub2sub3'], ['2sub3sub1', '2sub3sub2', '2sub3sub3'], ['3sub1', '3sub2', '3sub3'], ['3sub1sub1', '3sub1sub2', '3sub1sub3'], ['3sub2sub1', '3sub2sub2', '3sub2sub3'], ['3sub3sub1', '3sub3sub2', '3sub3sub3'], ['3sub3sub2_file.txt'], ['trailing_space sub1', 'trailing_space sub2'], ['trailing_space sub2_file.txt']]
directory_tree_to_list_of_lists(parent_directory)[source]

This takes a folder as an input and returns a list with its contents. If the directory has subdirectories, it returns a list of lists with the contents of those subdirectories.

expected_restored_tree = [['1', '2', '3', '1.py'], ['1sub1', '1sub2', '1sub3'], ['1sub1sub1', '1sub1sub3'], ['1sub1sub1_file.txt'], ['1sub2sub1'], ['1sub3sub3'], ['2sub1'], ['2sub1sub1'], ['2sub1sub1_file.txt'], ['3sub2', '3sub3'], ['3sub2sub1', '3sub2sub2', '3sub2sub3'], ['3sub3sub1', '3sub3sub2', '3sub3sub3'], ['3sub3sub2_file.txt']]
expected_restored_tree_with_trailing_space = [['1', '2', '3', 'trailing_space ', '1.py'], ['1sub1', '1sub2', '1sub3'], ['1sub1sub1', '1sub1sub3'], ['1sub1sub1_file.txt'], ['1sub2sub1'], ['1sub3sub3'], ['2sub1'], ['2sub1sub1'], ['2sub1sub1_file.txt'], ['3sub2', '3sub3'], ['3sub2sub1', '3sub2sub2', '3sub2sub3'], ['3sub3sub1', '3sub3sub2', '3sub3sub3'], ['3sub3sub2_file.txt'], ['trailing_space sub1', 'trailing_space sub2'], ['trailing_space sub2_file.txt']]
class testing.functional.test_selection.TestAbsolutePaths(methodName='runTest')[source]

Bases: IncludeExcludeFunctionalTest

Tests include/exclude options with absolute paths

test_absolute_paths_non_globbing()[source]

Test –include and –exclude work with absolute paths

class testing.functional.test_selection.TestAsterisks(methodName='runTest')[source]

Bases: IncludeExcludeFunctionalTest

Test to check that asterisks work as expected Exhibits the issue reported in Bug #884371 (https://bugs.launchpad.net/duplicity/+bug/884371). See the unit tests for more granularity on the issue.

restore_and_check()[source]

Restores the backup and compares to what is expected.

test_commandline_asterisks_double_both()[source]

test_commandline_include_exclude with double asterisks on both exclude and include lines.

test_commandline_asterisks_double_exclude_only()[source]

test_commandline_include_exclude with double asterisks on exclude lines.

test_commandline_asterisks_single_both()[source]

test_commandline_include_exclude with single asterisks on both exclude and include lines.

test_commandline_asterisks_single_excludes_only()[source]

test_commandline_include_exclude with single asterisks on exclude lines.

test_exclude_filelist_asterisks_double_asterisks()[source]

Exclude filelist with double asterisks replacing folders.

test_exclude_filelist_asterisks_none()[source]

Basic exclude filelist.

test_exclude_filelist_asterisks_single()[source]

Exclude filelist with asterisks replacing folders.

test_single_and_double_asterisks()[source]

This compares a backup using –include-globbing-filelist with a single and double *.

test_single_and_double_asterisks_includes_excludes()[source]

This compares a backup using –includes/–excludes with a single and double *.

class testing.functional.test_selection.TestCheckTestFiles(methodName='runTest')[source]

Bases: IncludeExcludeFunctionalTest

Tests the testfiles required by the exclude/include tests are as expected.

test_files_are_as_expected()[source]

Test that the contents of testfiles/select are as expected.

class testing.functional.test_selection.TestExcludeFilelistTest(methodName='runTest')[source]

Bases: IncludeExcludeFunctionalTest

Test –exclude-filelist using duplicity binary.

test_exclude_filelist()[source]

Test that exclude filelist works in the basic case

test_exclude_filelist_combined_imperfections()[source]

Test that exclude filelist works with imperfections in the input file

test_exclude_filelist_progress_option()[source]

Test that exclude filelist is unaffected by the –progress option

test_exclude_filelist_trailing_whitespace_folders_work_with_quotes()[source]

Test that folders with trailing whitespace in the names work correctly if they are enclosed in quotes

test_exclude_globbing_filelist_combined_imperfections()[source]

Test that exclude globbing filelist works with imperfections in the input file

test_exclude_globbing_filelist_is_always_globbing()[source]

Test that exclude globbing filelist works with imperfections in the input file

class testing.functional.test_selection.TestExcludeIfPresent(methodName='runTest')[source]

Bases: IncludeExcludeFunctionalTest

This tests the behaviour of duplicity’s –exclude-if-present option

test_exclude_if_present_baseline()[source]

Test that duplicity normally backs up files

test_exclude_if_present_excludes()[source]

Test that duplicity excludes files with relevant tag

test_exclude_if_present_excludes_2()[source]

Test that duplicity excludes files with relevant tag

class testing.functional.test_selection.TestFilesFrom(methodName='runTest')[source]

Bases: IncludeExcludeFunctionalTest

Tests behaviours when –files-from is used

test_error_on_files_from_absolute_path()[source]

Check expected failure on absolute paths

test_error_on_files_from_empty()[source]

Check expected failure if file list is empty

test_files_from_implicit_parents()[source]

Confirm that parent directories get included implicitly

test_files_from_multiple_filelists()[source]

Use filelists for both –files-from and –include-filelist

test_files_from_no_selections()[source]

Simplest use case, with no additional selection functions

test_files_from_null_separator()[source]

Using nulls to separate –files-from

test_files_from_trailing_space()[source]

Check that trailing space is preserved

test_files_from_trailing_space_folder()[source]

Check that trailing space is preserved where it isn’t delimited by another path component or implied by another path in the same file

test_files_from_with_exclusions()[source]

Apply some –exclude rules to a backup fileset defined by –files-from

test_files_from_with_inclusions()[source]

Apply some –exclude rules to a backup fileset defined by –files-from

testfiles_numbers = ['2', '2/2sub3', '2/2sub3/2sub3sub2', '2/2sub3/2sub3sub1', '2/2sub3/2sub3sub3', '2/2sub1', '2/2sub1/2sub1sub3', '2/2sub1/2sub1sub2', '2/2sub1/2sub1sub1', '2/2sub1/2sub1sub1/2sub1sub1_file.txt', '2/2sub2', '2/2sub2/2sub2sub3', '2/2sub2/2sub2sub1', '2/2sub2/2sub2sub2', '1.doc', '1.py', '1', '1/1sub3', '1/1sub3/1sub3sub2', '1/1sub3/1sub3sub1', '1/1sub3/1sub3sub3', '1/1sub1', '1/1sub1/1sub1sub2', '1/1sub1/1sub1sub2/1sub1sub2_file.txt', '1/1sub1/1sub1sub3', '1/1sub1/1sub1sub3/1sub1sub3_file.txt', '1/1sub1/1sub1sub1', '1/1sub1/1sub1sub1/1sub1sub1_file.txt', '1/1sub2', '1/1sub2/1sub2sub3', '1/1sub2/1sub2sub2', '1/1sub2/1sub2sub1', '3', '3/3sub3', '3/3sub3/3sub3sub3', '3/3sub3/3sub3sub1', '3/3sub3/3sub3sub2', '3/3sub3/3sub3sub2/3sub3sub2_file.txt', '3/3sub2', '3/3sub2/3sub2sub1', '3/3sub2/3sub2sub3', '3/3sub2/3sub2sub2', '3/3sub1', '3/3sub1/3sub1sub3', '3/3sub1/3sub1sub1', '3/3sub1/3sub1sub2']
class testing.functional.test_selection.TestFolderIncludesFiles(methodName='runTest')[source]

Bases: IncludeExcludeFunctionalTest

This tests that including a folder includes the files within it

test_excludes_files_no_trailing_slash()[source]

This tests that excluding a folder excludes the files within it

test_excludes_files_trailing_slash()[source]

Excluding a folder excludes the files within it, if ends with /

test_excludes_files_trailing_slash_globbing_chars()[source]

Tests folder excludes with globbing char and /

test_includes_files()[source]

This tests that including a folder includes the files within it

test_includes_files_trailing_slash()[source]

This tests that including a folder includes the files within it

test_includes_files_trailing_slash_globbing_chars()[source]

Tests folder includes with globbing char and /

class testing.functional.test_selection.TestGlobbingReplacement(methodName='runTest')[source]

Bases: IncludeExcludeFunctionalTest

This tests the behaviour of the extended shell globbing pattern replacement functions.

test_globbing_replacement_in_includes()[source]

Test behaviour of the extended shell globbing pattern replacement functions in both include and exclude

test_globbing_replacement_in_includes_using_filter_ignorecase()[source]

Test behaviour of the extended shell globbing pattern replacement functions in both include and exclude. same test as above, but implemented using –filter-*case instead of the ignorecase prefix.

class testing.functional.test_selection.TestIncludeExcludeFilterModes(methodName='runTest')[source]

Bases: IncludeExcludeFunctionalTest

Direct use of –include/–exclude with –filter-* mode switches used.

test_error_on_redundant_filter_option()[source]

Test for explicit specification of default filter options _only_.

test_error_on_trailing_filter_option()[source]

Test –filter-* as the last file selection option, which has no effect and should result in an error.

test_include_exclude_basic_with_modes()[source]

Test –include and –exclude work in the same way as done by TestIncludeExcludeSelectOptions, but when –filter-* switches in a way which should not change the outcome (with this specific file set).

test_include_exclude_trailing_whitespace_with_modes()[source]

Test that folders with trailing whitespace in the names work correctly when passing as include/exclude, specifically in literal mode.

test_literal_multiple_mode_switches()[source]
test_literal_multiple_mode_switches_with_filter_ignorecase()[source]
test_literal_multiple_mode_switches_with_ignorecase_prefix()[source]
test_literal_special_files()[source]

No reason this shouldn’t work as the differences in file selection code for literal-vs-regex-vs-globs is dealing only with strings. this is included for completeness and against the remote future possibility that those different filter implementations one day touch filesystem meta data and pick up interactions with special file types or attributes…

class testing.functional.test_selection.TestIncludeExcludeOptions(methodName='runTest')[source]

Bases: IncludeExcludeFunctionalTest

This tests the behaviour of the duplicity binary when the include/exclude options are passed directly

test_include_exclude_basic()[source]

Test –include and –exclude work in the basic case

test_include_exclude_trailing_whitespace()[source]

Test that folders with trailing whitespace in the names work correctly when passing as include/exclude

class testing.functional.test_selection.TestIncludeExcludedForContents(methodName='runTest')[source]

Bases: IncludeExcludeFunctionalTest

Test to check that folders that are excluded are included if they contain includes of higher priority. Exhibits the issue reported in Bug #1408411 (https://bugs.launchpad.net/duplicity/+bug/1408411).

restore_and_check()[source]

Restores the backup and compares to what was expected (based on the filelist in write_filelist)

test_commandline_include_exclude()[source]

test an excluded folder is included for included contents when using commandline includes and excludes

test_exclude_filelist()[source]

test an excluded folder is included for included contents with an exclude-filelist (non-globbing)

test_exclude_globbing_filelist()[source]

test an excluded folder is included for included contents with an exclude-globbing-filelist

test_include_filelist()[source]

test an excluded folder is included for included contents with an include-filelist (non-globbing)

test_include_globbing_filelist()[source]

test an excluded folder is included for included contents with an include-globbing-filelist

write_filelist(filelist_name)[source]

Used by the below tests to write the filelist

class testing.functional.test_selection.TestIncludeFilelistTest(methodName='runTest')[source]

Bases: IncludeExcludeFunctionalTest

Test –include-filelist using duplicity binary.

test_include_filelist()[source]

Test that include filelist works in the basic case

test_include_filelist_combined_imperfections()[source]

Test that include filelist works with imperfections in the input file

test_include_filelist_workaround_combined_imperfections_no_wildcards()[source]

Test that include filelist works with imperfections in the input file

test_include_globbing_filelist_combined_imperfections()[source]

Test that include globbing filelist works with imperfections in the input file

test_include_globbing_filelist_is_always_globbing()[source]

Test that include globbing filelist works with imperfections in the input file

class testing.functional.test_selection.TestIncludeSpecialGlobChars(methodName='runTest')[source]

Bases: IncludeExcludeFunctionalTest

Use of literal selection functions to match shell globbing characters

test_filelist_special_shell_chars()[source]

This test is the same as test_literal_special_shell_chars() except that an include file-list is used instead.

test_globbing_special_shell_chars()[source]

Selecting files using both literal and globbing selection functions on a fileset which contains literal shell characters

test_literal_special_shell_chars()[source]

Selecting files using literal selection functions which would have different interactions if interpreted as shell globs, e.g. ‘[01]’ which will not match the same as a glob, or 0?1 which would also match 0*1 in the same folder (where ? and * appear literally in the filenames).

class testing.functional.test_selection.TestLockedFoldersNoError(methodName='runTest')[source]

Bases: IncludeExcludeFunctionalTest

This tests that inaccessible folders do not cause an error

test_locked_baseline()[source]

Test no error if locked in path but excluded

test_locked_excl_if_present()[source]

Test no error if excluded locked with –exclude-if-present

class testing.functional.test_selection.TestSkipSocket(methodName='runTest')[source]

Bases: IncludeExcludeFunctionalTest

Tests correct handling of unix domain sockets in backuyp source

setUp()[source]

can’t put a socket into testfiles.tar.gz

sock_path = '/tmp/testfiles/various_file_types/socket'
test_socket_skipped_backup_path()[source]
test_socket_skipped_files_from()[source]
test_socket_skipped_include_filelist()[source]
class testing.functional.test_selection.TestTrailingSlash(methodName='runTest')[source]

Bases: IncludeExcludeFunctionalTest

Test to check that a trailing slash works as expected Exhibits the issue reported in Bug #932482 (https://bugs.launchpad.net/duplicity/+bug/932482).

restore_and_check()[source]

Restores the backup and compares to what is expected.

test_exclude_filelist_trailing_slashes()[source]

test_exclude_filelist_asterisks_none with trailing slashes.

test_exclude_filelist_trailing_slashes_double_wildcards_excludes()[source]

test_exclude_filelist_trailing_slashes with double wildcards in excludes.

test_exclude_filelist_trailing_slashes_double_wildcards_excludes_2()[source]

second test_exclude_filelist_trailing_slashes with double wildcards in excludes.

test_exclude_filelist_trailing_slashes_single_wildcards_excludes()[source]

test_exclude_filelist_trailing_slashes with single wildcards in excludes.

test_exclude_filelist_trailing_slashes_wildcards()[source]

test_commandline_asterisks_single_excludes_only with trailing slashes.

class testing.functional.test_selection.TestTrailingSlash2(methodName='runTest')[source]

Bases: IncludeExcludeFunctionalTest

This tests the behaviour of globbing strings with a trailing slash

test_include_files_not_subdirectories()[source]

Test that a trailing slash glob followed by a * glob only matches files and not subdirectories

test_include_subdirectories_not_files()[source]

Test that a trailing slash glob only matches directories

test_no_trailing_slash()[source]

Test that including 1.py works as expected

test_trailing_slash()[source]

Test that globs with a trailing slash only match directories

class testing.functional.test_selection.TestUnicode(methodName='runTest')[source]

Bases: IncludeExcludeFunctionalTest

Tests include/exclude options with unicode paths

test_unicode_filelist()[source]

Test that exclude filelist works with unicode filenames

test_unicode_paths_asterisks()[source]

Test –include and –exclude work with unicode paths and globs containing * and **

test_unicode_paths_non_globbing()[source]

Test –include and –exclude work with unicode paths

test_unicode_paths_square_brackets()[source]

Test –include and –exclude work with unicode paths with character options in []s and [!]s