def test_sort_locations_file_find_link(): """ Test that a file:// find-link dir gets listdir run """ finder = PackageFinder([find_links], []) files, urls = finder._sort_locations([find_links]) assert files and not urls, "files and not urls should have been found at find-links url: %s" % find_links
def test_sort_locations_file_not_find_link(data): """ Test that a file:// url dir that's not a find-link, doesn't get a listdir run """ finder = PackageFinder([], []) files, urls = finder._sort_locations(data.index_url("empty_with_pkg")) assert urls and not files, "urls, but not files should have been found"
def test_sort_locations_file_find_link(data): """ Test that a file:// find-link dir gets listdir run """ finder = PackageFinder([data.find_links], []) files, urls = finder._sort_locations([data.find_links]) assert files and not urls, "files and not urls should have been found at find-links url: %s" % data.find_links
def test_sort_locations_non_existing_path(): """ Test that a non-existing path is ignored. """ finder = PackageFinder([], [], session=PipSession()) files, urls = finder._sort_locations( [os.path.join('this', 'doesnt', 'exist')]) assert not urls and not files, "nothing should have been found"
def test_sort_locations_file_not_find_link(): """ Test that a file:// url dir that's not a find-link, doesn't get a listdir run """ index_url = path_to_url(os.path.join(tests_data, 'indexes', 'empty_with_pkg')) finder = PackageFinder([], []) files, urls = finder._sort_locations([index_url]) assert urls and not files, "urls, but not files should have been found"
def test_sort_locations_file_not_find_link(): """ Test that a file:// url dir that's not a find-link, doesn't get a listdir run """ index_url = path_to_url(os.path.join(here, 'indexes', 'empty_with_pkg')) finder = PackageFinder([], []) files, urls = finder._sort_locations([index_url]) assert urls and not files, "urls, but not files should have been found"
def test_sort_locations_file_expand_dir(data): """ Test that a file:// dir gets listdir run with expand_dir """ finder = PackageFinder([data.find_links], [], session=PipSession()) files, urls = finder._sort_locations([data.find_links], expand_dir=True) assert files and not urls, ( "files and not urls should have been found at find-links url: %s" % data.find_links)
def test_sort_locations_file_find_link(): """ Test that a file:// find-link dir gets listdir run """ find_links_url = path_to_url(os.path.join(here, 'packages')) find_links = [find_links_url] finder = PackageFinder(find_links, []) files, urls = finder._sort_locations(find_links) assert files and not urls, "files and not urls should have been found at find-links url: %s" % find_links_url
def test_sort_locations_file_expand_dir(data): """ Test that a file:// dir gets listdir run with expand_dir """ finder = PackageFinder([data.find_links], [], session=PipSession()) files, urls = finder._sort_locations([data.find_links], expand_dir=True) assert files and not urls, ( "files and not urls should have been found at find-links url: %s" % data.find_links )