Skip to content

Commit

Permalink
Do not break when running the tests from a wheel.
Browse files Browse the repository at this point in the history
The wheel does neither include `setup.py` nor the `docs` dir.
So omit the documentation tests when no `setup.py` can be found.
This should fix the tests in ZTK.
  • Loading branch information
Michael Howitz committed Feb 9, 2019
1 parent e2939ad commit 89d7014
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Changes
4.3.1 (unreleased)
------------------

- Nothing changed yet.
- Do not break when running the tests from a wheel.


4.3.0 (2018-10-01)
Expand Down
7 changes: 4 additions & 3 deletions src/zope/configuration/tests/test_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
from __future__ import print_function

import re
import sys
import os.path
import unittest
import doctest
Expand Down Expand Up @@ -49,12 +48,15 @@
)

def test_suite():
suite = unittest.TestSuite()
here = os.path.dirname(os.path.abspath(__file__))
while not os.path.exists(os.path.join(here, 'setup.py')):
prev, here = here, os.path.dirname(here)
if here == prev:
# Let's avoid infinite loops at root
raise AssertionError('could not find my setup.py')
print('tests_doc.py: WARNING could not find setup.py -->'
' omitting documentation tests.') # pragma: no cover
return suite # pragma: no cover

docs = os.path.join(here, 'docs')
api_docs = os.path.join(docs, 'api')
Expand Down Expand Up @@ -89,7 +91,6 @@ def test_suite():
m += manuel.codeblock.Manuel()
m += manuel.capture.Manuel()

suite = unittest.TestSuite()
suite.addTest(
manuel.testing.TestSuite(
m,
Expand Down

0 comments on commit 89d7014

Please sign in to comment.