Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <h2>Edit: Summary</h2> <p>Stepping through your test case with the debugger, it look's like this is a limitation of PyDev's test runner not supporting <code>setUpClass()</code>, at least not with 1.6.5, which I'm using.</p> <p>Maybe this will be fixed in v2.0 of PyDev, but in the meantime, I think we will have to <a href="https://stackoverflow.com/questions/5336626/giving-parameters-into-testcase-from-suite-in-python/5381422#5381422">stick</a> to using <code>__init__()</code> instead, as <a href="https://stackoverflow.com/questions/5430707/initialization-of-unit-test-in-pydev/5480499#5480499">CarlS</a> suggests.</p> <h3>Details</h3> <p>The PyDev 1.6.5 PyDevTestSuite class uses:</p> <pre><code>def run(self, result): for index, test in enumerate(self._tests): if result.shouldStop: break test(result) # Let the memory be released! self._tests[index] = None return result </code></pre> <p>which is very similar to TestSuite.run() in python 2.6, whereas TestSuite.run() in python 2.7.1's unittest does rather more:</p> <pre><code>def run(self, result, debug=False): topLevel = False if getattr(result, '_testRunEntered', False) is False: result._testRunEntered = topLevel = True for test in self: if result.shouldStop: break if _isnotsuite(test): self._tearDownPreviousClass(test, result) self._handleModuleFixture(test, result) self._handleClassSetUp(test, result) result._previousTestClass = test.__class__ if (getattr(test.__class__, '_classSetupFailed', False) or getattr(result, '_moduleSetUpFailed', False)): continue if not debug: test(result) else: test.debug() if topLevel: self._tearDownPreviousClass(None, result) self._handleModuleTearDown(result) return result </code></pre> <h2>Old answer</h2> <p>I suspect this may be down to the version of Python that is being referenced.</p> <p>If you check Window > Preferences > PyDev > Interpreter - Python and look at which Python Interpretter is being used, you may well find that it is pre v2.7 where, if I remember correctly, setUpClass was introduced.</p> <p>Reference a newer version of python and I suspect your tests will work as is.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload