Test the compare function
(self)
| 27 | CONFIG_NAME = 'config.yaml' |
| 28 | |
| 29 | def test_listings(self): |
| 30 | """Test the compare function""" |
| 31 | # setup some directories |
| 32 | fold_config = os.path.join(os.path.expanduser('~'), '.config') |
| 33 | create_dir(fold_config) |
| 34 | fold_subcfg = os.path.join(os.path.expanduser('~'), '.config', |
| 35 | get_string(5)) |
| 36 | create_dir(fold_subcfg) |
| 37 | self.addCleanup(clean, fold_subcfg) |
| 38 | fold_tmp = get_tempdir() |
| 39 | create_dir(fold_tmp) |
| 40 | self.addCleanup(clean, fold_tmp) |
| 41 | |
| 42 | # create the directories |
| 43 | tmp = get_tempdir() |
| 44 | self.assertTrue(os.path.exists(tmp)) |
| 45 | self.addCleanup(clean, tmp) |
| 46 | |
| 47 | dotfilespath = get_tempdir() |
| 48 | self.assertTrue(os.path.exists(dotfilespath)) |
| 49 | self.addCleanup(clean, dotfilespath) |
| 50 | |
| 51 | # create the dotfiles to test |
| 52 | file1, _ = create_random_file(fold_config) |
| 53 | self.assertTrue(os.path.exists(file1)) |
| 54 | self.addCleanup(clean, file1) |
| 55 | file2, _ = create_random_file(fold_subcfg) |
| 56 | self.assertTrue(os.path.exists(file2)) |
| 57 | self.addCleanup(clean, file2) |
| 58 | file3, _ = create_random_file(fold_tmp) |
| 59 | self.assertTrue(os.path.exists(file3)) |
| 60 | self.addCleanup(clean, file3) |
| 61 | file4, _ = create_random_file(fold_tmp, binary=True) |
| 62 | self.assertTrue(os.path.exists(file4)) |
| 63 | self.addCleanup(clean, file4) |
| 64 | file5 = get_tempdir() |
| 65 | self.assertTrue(os.path.exists(file5)) |
| 66 | self.addCleanup(clean, file5) |
| 67 | file6, _ = create_random_file(file5) |
| 68 | self.assertTrue(os.path.exists(file6)) |
| 69 | |
| 70 | # create the config file |
| 71 | profile = get_string(5) |
| 72 | confpath = create_fake_config(dotfilespath, |
| 73 | configname=self.CONFIG_NAME, |
| 74 | dotpath=self.CONFIG_DOTPATH, |
| 75 | backup=self.CONFIG_BACKUP, |
| 76 | create=self.CONFIG_CREATE) |
| 77 | self.assertTrue(os.path.exists(confpath)) |
| 78 | opt = load_options(confpath, profile) |
| 79 | dfiles = [file1, file2, file3, file4, file5] |
| 80 | |
| 81 | # import the files |
| 82 | opt.import_path = dfiles |
| 83 | cmd_importer(opt) |
| 84 | opt = load_options(confpath, profile) |
| 85 | |
| 86 | # files |
nothing calls this directly
no test coverage detected