Skip to content

Commit

Permalink
Set the type of Event._attrs
Browse files Browse the repository at this point in the history
This fixes a number of mypy errors.

Additionally, replace a lambda to allow for better type inference
(removes a misc mypy error).
  • Loading branch information
sirosen committed May 31, 2024
1 parent b19e371 commit 63e0a04
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion nose2/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import argparse
import logging
import typing as t
import unittest

from nose2 import config, util
Expand Down Expand Up @@ -363,7 +364,7 @@ class Event:
"""

_attrs = ("handled",)
_attrs: t.ClassVar[tuple[str, ...]] = ("handled",)
version = "0.4"

def __init__(self, **metadata):
Expand Down
6 changes: 5 additions & 1 deletion nose2/tests/unit/test_prof_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ def tearDown(self):
def test_startTestRun_sets_executeTests(self):
_prof = Stub()
_prof.runcall = object()
prof.cProfile.Profile = lambda: _prof

def _profile_call() -> Stub:
return _prof

prof.cProfile.Profile = _profile_call
event = StartTestRunEvent(
runner=None, suite=None, result=None, startTime=None, executeTests=None
)
Expand Down

0 comments on commit 63e0a04

Please sign in to comment.