def test_collect_can_collect_a_single_file(self): test_file = ('about_code_tool/tests/testdata/thirdparty/django_snippets_2413.ABOUT') if on_windows: expected = [posix_path(UNC_PREFIX + os.path.abspath('about_code_tool/tests/testdata/thirdparty/django_snippets_2413.ABOUT'))] else: expected = [os.path.abspath('about_code_tool/tests/testdata/thirdparty/django_snippets_2413.ABOUT')] result = Collector.collect(test_file) self.assertEqual(expected, result)
def test_collect_can_collect_a_directory_tree(self): test_dir = 'about_code_tool/tests/testdata/DateTest' if on_windows: expected = [ (posix_path(UNC_PREFIX + os.path.abspath('about_code_tool/tests/testdata/DateTest/non-supported_date_format.ABOUT'))), (posix_path(UNC_PREFIX + os.path.abspath('about_code_tool/tests/testdata/DateTest/supported_date_format.ABOUT'))) ] else: expected = [ (os.path.abspath('about_code_tool/tests/testdata/DateTest/non-supported_date_format.ABOUT')), (os.path.abspath('about_code_tool/tests/testdata/DateTest/supported_date_format.ABOUT')) ] result = Collector.collect(test_dir) self.assertEqual(sorted(expected), sorted(result))
def test_collect_can_collect_a_directory_tree_with_long_and_deep_paths(self): test_zip = 'about_code_tool/tests/testdata/longpath/longpath.zip' test_dir = extract_zip(test_zip) longpath = 'longpath1/' * 28 expected = 'longpath/' + longpath + 'non-supported_date_format.ABOUT' result = Collector.collect(test_dir)[0] def rel_path(pth): p = posix_path(pth) return p.partition('/longpath/')[2] print() print(result) print(rel_path(result)) self.assertEqual(expected, rel_path(result))