51 lines
1.3 KiB
Diff
51 lines
1.3 KiB
Diff
From a48f24f5fdbe3877e13ebca66ed002cabb4b5968 Mon Sep 17 00:00:00 2001
|
|
From: Jason Alan Palmer <[email protected]>
|
|
Date: Sun, 9 Feb 2025 17:06:31 -0700
|
|
Subject: [PATCH] Stop using the deprecated pkg_resources
|
|
|
|
---
|
|
tests/test_pdftotext.py | 24 +++++-------------------
|
|
1 file changed, 5 insertions(+), 19 deletions(-)
|
|
|
|
diff --git a/tests/test_pdftotext.py b/tests/test_pdftotext.py
|
|
index 66c994d..8f329d1 100644
|
|
--- a/tests/test_pdftotext.py
|
|
+++ b/tests/test_pdftotext.py
|
|
@@ -1,31 +1,17 @@
|
|
"""Tests for the pdftotext module."""
|
|
|
|
+import importlib.resources
|
|
import io
|
|
-import pkg_resources
|
|
import unittest
|
|
|
|
import pdftotext
|
|
|
|
|
|
-file_names = [
|
|
- "abcde.pdf",
|
|
- "blank.pdf",
|
|
- "both_passwords.pdf",
|
|
- "corrupt.pdf",
|
|
- "corrupt_page.pdf",
|
|
- "landscape_0.pdf",
|
|
- "landscape_90.pdf",
|
|
- "portrait.pdf",
|
|
- "table.pdf",
|
|
- "three_columns.pdf",
|
|
- "two_pages.pdf",
|
|
- "user_password.pdf",
|
|
-]
|
|
test_files = {}
|
|
-for file_name in file_names:
|
|
- file_path = pkg_resources.resource_filename("tests", file_name)
|
|
- with open(file_path, "rb") as open_file:
|
|
- test_files[file_name] = io.BytesIO(open_file.read())
|
|
+directory = importlib.resources.files("tests")
|
|
+for f in directory.iterdir():
|
|
+ if f.name.endswith(".pdf"):
|
|
+ test_files[f.name] = io.BytesIO(f.read_bytes())
|
|
|
|
|
|
def get_file(name):
|