Skip to content

Commit

Permalink
Update tests for Python 3.13, add nocover in pshell
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
digitalresistor committed Oct 26, 2024
1 parent d573b98 commit bc84ac3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/pyramid/scripts/pshell.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def setup_env(self):
if k not in orig_env or v is not orig_env[k]:
if getattr(v, '__doc__', False):
env_help[k] = v.__doc__.replace("\n", " ")
else:
else: # pragma: nocover -- Python >= 3.13 has a __doc__
env_help[k] = v
del orig_env

Expand Down
10 changes: 2 additions & 8 deletions tests/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,10 @@ def worker(obj):
self.assertEqual(1, foo.y)

def test_property_without_name(self):
def worker(obj): # pragma: no cover
pass

foo = Dummy()
helper = self._getTargetClass()
self.assertRaises(
ValueError, helper.set_property, foo, property(worker)
ValueError, helper.set_property, foo, "has_no___name__"
)

def test_property_with_name(self):
Expand Down Expand Up @@ -271,11 +268,8 @@ def worker(obj):
self.assertEqual(1, foo.y)

def test_property_without_name(self):
def worker(obj): # pragma: no cover
pass

foo = self._makeOne()
self.assertRaises(ValueError, foo.set_property, property(worker))
self.assertRaises(ValueError, foo.set_property, "has_no___name__")

def test_property_with_name(self):
def worker(obj):
Expand Down

0 comments on commit bc84ac3

Please sign in to comment.