Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkowl committed May 19, 2019
1 parent 4e4f8cf commit 13aa60c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
8 changes: 5 additions & 3 deletions src/twisted/trial/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -724,8 +724,8 @@ def findByName(self, _name, recurse=False):
break

except ImportError:
# Check to see where the ImportError happened. If it happened in
# this file, ignore it.
# Check to see where the ImportError happened. If it happened
# in this file, ignore it.
tb = sys.exc_info()[2]

# Walk down to the deepest frame, where it actually happened.
Expand All @@ -742,7 +742,9 @@ def findByName(self, _name, recurse=False):
raise

if remaining == "":
raise reflect.ModuleNotFound("The module {} does not exist.".format(name))
raise reflect.ModuleNotFound(
"The module {} does not exist.".format(name)
)

if obj is None:
# If it's none here, we didn't get to import anything.
Expand Down
14 changes: 8 additions & 6 deletions src/twisted/trial/test/test_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,17 @@ def test_findObject(self):


def test_findNonModule(self):
self.assertRaises(AttributeError,
self.loader.findByName,
'twisted.trial.test.nonexistent')
self.assertRaises(
AttributeError, self.loader.findByName,
'twisted.trial.test.nonexistent'
)


def test_findNonPackage(self):
self.assertRaises(ValueError,
self.loader.findByName,
'nonextant')
self.assertRaises(
ValueError, self.loader.findByName,
'nonextant'
)


def test_findNonFile(self):
Expand Down

0 comments on commit 13aa60c

Please sign in to comment.