Skip to content

Commit bc84ac3

Browse files
Update tests for Python 3.13, add nocover in pshell
Inner functions such as: def outer(): def inner(): pass Now have an attribute called `__name__`, which will be set to `inner`. Also it seems that there is a `__doc__` attribute that is now standard, and thus we add a pragma nocover to pshell.
1 parent d573b98 commit bc84ac3

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed

src/pyramid/scripts/pshell.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ def setup_env(self):
193193
if k not in orig_env or v is not orig_env[k]:
194194
if getattr(v, '__doc__', False):
195195
env_help[k] = v.__doc__.replace("\n", " ")
196-
else:
196+
else: # pragma: nocover -- Python >= 3.13 has a __doc__
197197
env_help[k] = v
198198
del orig_env
199199

tests/test_util.py

+2-8
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,10 @@ def worker(obj):
6666
self.assertEqual(1, foo.y)
6767

6868
def test_property_without_name(self):
69-
def worker(obj): # pragma: no cover
70-
pass
71-
7269
foo = Dummy()
7370
helper = self._getTargetClass()
7471
self.assertRaises(
75-
ValueError, helper.set_property, foo, property(worker)
72+
ValueError, helper.set_property, foo, "has_no___name__"
7673
)
7774

7875
def test_property_with_name(self):
@@ -271,11 +268,8 @@ def worker(obj):
271268
self.assertEqual(1, foo.y)
272269

273270
def test_property_without_name(self):
274-
def worker(obj): # pragma: no cover
275-
pass
276-
277271
foo = self._makeOne()
278-
self.assertRaises(ValueError, foo.set_property, property(worker))
272+
self.assertRaises(ValueError, foo.set_property, "has_no___name__")
279273

280274
def test_property_with_name(self):
281275
def worker(obj):

0 commit comments

Comments
 (0)