Skip to content

Fixed dummy runTest on functional test case. [2.13] #89

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

Merged
merged 1 commit into from
Jan 18, 2017

Conversation

mauritsvanrees
Copy link
Member

In functional doc tests you can apparently have a test case that has no runTest method. Until now the Testing package added a dummy runTest method in that case, and set it to None.

But when this dummy runTest method gets called, you get an error:

  Error in test runTest (Testing.ZopeTestCase.ZopeTestCase.FunctionalTestCase)
  Traceback (most recent call last):
    File ".../lib/python2.7/unittest/case.py", line 329, in run
      testMethod()
  TypeError: 'NoneType' object is not callable

Simply importing Testing.ZopeTestCase.FunctionalTestCase in a new test file may be enough to trigger this.

So this has something to do with the order in which tests are found.

I fixed it by making the dummy runTest method callable.

This is related to remarks in #88, which is where I took this commit from.

In functional doc tests you can apparently have a test case that has
no runTest method.  Until now the Testing package added a dummy
runTest method in that case, and set it to None.

But when this dummy runTest method gets called, you get an error:

  Error in test runTest (Testing.ZopeTestCase.ZopeTestCase.FunctionalTestCase)
  Traceback (most recent call last):
    File ".../lib/python2.7/unittest/case.py", line 329, in run
      testMethod()
  TypeError: 'NoneType' object is not callable

Simply importing Testing.ZopeTestCase.FunctionalTestCase in a new test
file may be enough to trigger this.

So this has something to do with the order in which tests are found.

I fixed it by making the dummy runTest method callable.
@hannosch hannosch merged commit ecfd7b1 into 2.13 Jan 18, 2017
@hannosch hannosch deleted the fix-dummy-runtest-213 branch January 18, 2017 10:31
mauritsvanrees added a commit to plone/buildout.coredev that referenced this pull request Feb 1, 2017
mauritsvanrees added a commit to plone/buildout.coredev that referenced this pull request Feb 14, 2017
This is only needed for tests.  Otherwise you get one failure when running alltests:

'NoneType' object is not callable

  File "/usr/lib/python2.7/unittest/case.py", line 329, in run
    testMethod()

It was fixed here:
zopefoundation/Zope#89
anand-sd pushed a commit to anand-sd/Zope that referenced this pull request Jul 29, 2024
* Enable coveralls

Test coverage is not at 100% yet so it should fail this PR.

Also enable pip caching since we are installing more deps.

Update PyPy versions to latest available for speed and because the old
version of PyPy3 can't install newer pip and coverage, etc.

Partially addresses zopefoundation#87

* Even newer pypys

* Despite the list, pypy-5.6 doesn,t work, it must be 5.6.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants