From 7f5a499ccc63a10302fcc8021dcfae90ee97866f Mon Sep 17 00:00:00 2001 From: Daniel Schadt Date: Sat, 27 Dec 2025 14:52:41 +0100 Subject: remove pkg_resources calls This is mostly based on work by luhn. From a quick test with my pyramid project, it seems to work fine, but I haven't tested more complex setups. At least my template renderings and static files didn't break, and I checked a single asset override which also worked. --- tests/test_path.py | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) (limited to 'tests/test_path.py') diff --git a/tests/test_path.py b/tests/test_path.py index f93b0ae90..12c0d4a64 100644 --- a/tests/test_path.py +++ b/tests/test_path.py @@ -259,34 +259,23 @@ class TestPkgResourcesAssetDescriptor(unittest.TestCase): def test_stream(self): inst = self._makeOne() - inst.pkg_resources = DummyPkgResource() - inst.pkg_resources.resource_stream = lambda x, y: f'{x}:{y}' - s = inst.stream() - self.assertEqual(s, '{}:{}'.format('tests', 'test_asset.py')) + stream = inst.stream() + data = stream.read(9) + self.assertEqual(data, b"import os") def test_isdir(self): inst = self._makeOne() - inst.pkg_resources = DummyPkgResource() - inst.pkg_resources.resource_isdir = lambda x, y: f'{x}:{y}' - self.assertEqual( - inst.isdir(), '{}:{}'.format('tests', 'test_asset.py') - ) + self.assertEqual(inst.isdir(), False) def test_listdir(self): - inst = self._makeOne() - inst.pkg_resources = DummyPkgResource() - inst.pkg_resources.resource_listdir = lambda x, y: f'{x}:{y}' - self.assertEqual( - inst.listdir(), '{}:{}'.format('tests', 'test_asset.py') - ) + inst = self._makeOne(path="") + content = inst.listdir() + self.assertIn("test_asset.py", content) + self.assertNotIn("test_foobardou", content) def test_exists(self): inst = self._makeOne() - inst.pkg_resources = DummyPkgResource() - inst.pkg_resources.resource_exists = lambda x, y: f'{x}:{y}' - self.assertEqual( - inst.exists(), '{}:{}'.format('tests', 'test_asset.py') - ) + self.assertEqual(inst.exists(), True) class TestFSAssetDescriptor(unittest.TestCase): -- cgit v1.2.3