diff options
| author | Daniel Schadt <kingdread@gmx.de> | 2025-12-27 14:52:41 +0100 |
|---|---|---|
| committer | Daniel Schadt <kingdread@gmx.de> | 2025-12-27 14:52:41 +0100 |
| commit | 7f5a499ccc63a10302fcc8021dcfae90ee97866f (patch) | |
| tree | eb94bd3b5e67e4c91614853c9de20b76dc1d7dc2 /tests/test_path.py | |
| parent | 33a7811d24ea88c558ec03acf5e016e7c84ddefa (diff) | |
| download | pyramid-main.tar.gz pyramid-main.tar.bz2 pyramid-main.zip | |
remove pkg_resources callsmain
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.
Diffstat (limited to 'tests/test_path.py')
| -rw-r--r-- | tests/test_path.py | 29 |
1 files changed, 9 insertions, 20 deletions
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): |
