Skip to content
This repository has been archived by the owner on Jan 20, 2019. It is now read-only.

Commit

Permalink
Fix working with named test
Browse files Browse the repository at this point in the history
I'm running a test method inside a TestCase directly with `--tests=path.to.the:TestCase.test_method` and getting a mysterious failure:

```
======================================================================
ERROR: Failure: TypeError ('ExternalTicketsTest' object is not iterable)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/opt/yplan/venv/local/lib/python2.7/site-packages/nose/plugins/manager.py", line 154, in generate
    for r in result:
TypeError: 'ExternalTicketsTest' object is not iterable
```

It looks like, similar to the `FunctionTestCase` line, the plugin should return a list of found tests rather than the test case, to nose. Making this change locally works.

Not sure if this is also required for the `MethodTestCase` line, and how to write a test.
  • Loading branch information
Adam Chainz committed Jul 8, 2015
1 parent 916a411 commit 1c42421
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion randomize/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def makeTest(self, obj, parent=None):
if parent is None:
parent = obj.__class__
if issubclass(parent, unittest.TestCase):
return parent(obj.__name__)
return [parent(obj.__name__)]
else:
if isgenerator(obj):
return ldr.loadTestsFromGeneratorMethod(obj, parent)
Expand Down

0 comments on commit 1c42421

Please sign in to comment.