Skip to content

Commit c7315aa

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 c7315aa

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-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 always has a __doc__
197197
env_help[k] = v
198198
del orig_env
199199

tests/test_util.py

+3-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import sys
22
import unittest
3+
import pytest
34

45
from pyramid.util import bytes_, text_
56

@@ -66,13 +67,10 @@ def worker(obj):
6667
self.assertEqual(1, foo.y)
6768

6869
def test_property_without_name(self):
69-
def worker(obj): # pragma: no cover
70-
pass
71-
7270
foo = Dummy()
7371
helper = self._getTargetClass()
7472
self.assertRaises(
75-
ValueError, helper.set_property, foo, property(worker)
73+
ValueError, helper.set_property, foo, "has_no___name__"
7674
)
7775

7876
def test_property_with_name(self):
@@ -271,11 +269,8 @@ def worker(obj):
271269
self.assertEqual(1, foo.y)
272270

273271
def test_property_without_name(self):
274-
def worker(obj): # pragma: no cover
275-
pass
276-
277272
foo = self._makeOne()
278-
self.assertRaises(ValueError, foo.set_property, property(worker))
273+
self.assertRaises(ValueError, foo.set_property, "has_no___name__")
279274

280275
def test_property_with_name(self):
281276
def worker(obj):

0 commit comments

Comments
 (0)