Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Treat methodName="runTest" similar to unittest.TestCase #373

Merged
merged 2 commits into from
May 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion testtools/testcase.py
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,17 @@ def _run_teardown(self, result):

def _get_test_method(self):
method_name = getattr(self, "_testMethodName")
return getattr(self, method_name)
try:
m = getattr(self, method_name)
except AttributeError:
if method_name != "runTest":
# We allow instantiation with no explicit method name
# but not an *incorrect* or missing method name.
raise ValueError(
"no such test method in %s: %s" % (self.__class__, method_name)
)
else:
return m

def _run_test_method(self, result):
"""Run the test method for this test.
Expand Down