What can cause this unicode object is not callable error in nosetests lib?
<p>I have a test case that tests some flow in an API (uses <code>requests.Session()</code> and makes multiple calls to our backend.)</p>

<p>This test case passes on my mac and on other peoples macs. But when its executed in Jenkins I get an error. There are other similar tests cases like this that pass without issues in Jenkins. Unfortunately I cannot share the test code itself. </p>

<p>Jenkins is running on Ubuntu 14.04</p>

<p>But here are first lines of the test code if it helps.</p>

<pre><code># filename: test_payment_visa.py

import unittest
from tests.utils import WWHTTPClient
import math
from nose.plugins.attrib import attr


class TestPaymentWorkflow(unittest.TestCase):
    def setUp(self):
        self.ww_api = WWHTTPClient()

    def test_payment_visa(self):
        """Test for Payment Workflow via VISA"""
</code></pre>

<p>Does anyone have an idea what this can be related to?</p>

<pre><code>Traceback (most recent call last):
  File "/var/lib/jenkins/.virtualenvs/api-tests/bin/nosetests", line 11, in &lt;module&gt;
    sys.exit(run_exit())
  File "/var/lib/jenkins/.virtualenvs/api-tests/local/lib/python2.7/site-packages/nose/core.py", line 121, in __init__
    **extra_args)
  File "/usr/lib/python2.7/unittest/main.py", line 95, in __init__
    self.runTests()
  File "/var/lib/jenkins/.virtualenvs/api-tests/local/lib/python2.7/site-packages/nose/core.py", line 207, in runTests
    result = self.testRunner.run(self.test)
  File "/var/lib/jenkins/.virtualenvs/api-tests/local/lib/python2.7/site-packages/nose/core.py", line 62, in run
    test(result)
  File "/var/lib/jenkins/.virtualenvs/api-tests/local/lib/python2.7/site-packages/nose/suite.py", line 177, in __call__
    return self.run(*arg, **kw)
  File "/var/lib/jenkins/.virtualenvs/api-tests/local/lib/python2.7/site-packages/nose/suite.py", line 224, in run
    test(orig)
  File "/usr/lib/python2.7/unittest/suite.py", line 70, in __call__
    return self.run(*args, **kwds)
  File "/var/lib/jenkins/.virtualenvs/api-tests/local/lib/python2.7/site-packages/nose/suite.py", line 75, in run
    test(result)
  File "/var/lib/jenkins/.virtualenvs/api-tests/local/lib/python2.7/site-packages/nose/suite.py", line 177, in __call__
    return self.run(*arg, **kw)
  File "/var/lib/jenkins/.virtualenvs/api-tests/local/lib/python2.7/site-packages/nose/suite.py", line 224, in run
    test(orig)
  File "/var/lib/jenkins/.virtualenvs/api-tests/local/lib/python2.7/site-packages/nose/suite.py", line 177, in __call__
    return self.run(*arg, **kw)
  File "/var/lib/jenkins/.virtualenvs/api-tests/local/lib/python2.7/site-packages/nose/suite.py", line 224, in run
    test(orig)
  File "/var/lib/jenkins/.virtualenvs/api-tests/local/lib/python2.7/site-packages/nose/suite.py", line 177, in __call__
    return self.run(*arg, **kw)
  File "/var/lib/jenkins/.virtualenvs/api-tests/local/lib/python2.7/site-packages/nose/suite.py", line 224, in run
    test(orig)
  File "/var/lib/jenkins/.virtualenvs/api-tests/local/lib/python2.7/site-packages/nose/case.py", line 45, in __call__
    return self.run(*arg, **kwarg)
  File "/var/lib/jenkins/.virtualenvs/api-tests/local/lib/python2.7/site-packages/nose/case.py", line 138, in run
    result.addError(self, err)
  File "/var/lib/jenkins/.virtualenvs/api-tests/local/lib/python2.7/site-packages/nose/proxy.py", line 131, in addError
    plugins.addError(self.test, err)
  File "/var/lib/jenkins/.virtualenvs/api-tests/local/lib/python2.7/site-packages/nose/plugins/manager.py", line 99, in __call__
    return self.call(*arg, **kw)
  File "/var/lib/jenkins/.virtualenvs/api-tests/local/lib/python2.7/site-packages/nose/plugins/manager.py", line 167, in simple
    result = meth(*arg, **kw)
  File "/var/lib/jenkins/.virtualenvs/api-tests/local/lib/python2.7/site-packages/nose/plugins/xunit.py", line 288, in addError
    id = test.id()
  File "/var/lib/jenkins/.virtualenvs/api-tests/local/lib/python2.7/site-packages/nose/case.py", line 85, in id
    return self.test.id()
TypeError: 'unicode' object is not callable
</code></pre>

<p>So there was a problem with my code.</p>

<p>I used a statement <code>self.id = r.json()["orders"][0]["id"]</code></p>

<pre><code># filename: test_payment_visa.py

import unittest
from tests.utils import WWHTTPClient
import math
from nose.plugins.attrib import attr


class TestPaymentWorkflow(unittest.TestCase):
    def setUp(self):
        self.ww_api = WWHTTPClient()

    def test_payment_visa(self):
        """Test for Payment Workflow via VISA"""    
        ...
        ...
        self.id = r.json()["orders"][0]["id"]
        ...
        ...
</code></pre>

<p>Problem is that <code>unittest.TestCase</code> clas has a method called <code>id</code>.</p>

<pre><code>def id(self):
    """Get a short(er) description of the test
    """
    return self.test.id()
</code></pre>

<p>So I assume that during test run I set <code>self.id</code> to a unicode string and then <code>nosetests</code> is trying to call its <code>id</code> method and is getting <code>TypeError: 'unicode' object is not callable</code> exception.</p>

python jenkins nose