3
ˆdR  ã               @   s    d Z ddlZddlZdd„ ZdS )a   Tools for having doctest and unittest work together more nicely.

    Eclipse's PyDev plugin will run your unittest files for you very nicely.
    The doctest_for_module function allows you to easily run the doctest for a
    module along side your standard unit tests within Eclipse.
é    Nc                s   G ‡ fdd„dt jƒ}|S )a   Create a TestCase from a module's doctests that will be run by the
        standard unittest.main().

        Example tests/test_foo.py::

            import unittest

            import foo
            from traits.testing.api import doctest_for_module

            class FooTestCase(unittest.TestCase):
                ...

            class FooDocTest(doctest_for_module(foo)):
                pass

            if __name__ == "__main__":
                # This will run and report both FooTestCase and the doctests in
                # module foo.
                unittest.main()

        Alternatively, you can say::

            FooDocTest = doctest_for_module(foo)

        instead of::

            class FooDocTest(doctest_for_module(foo)):
                pass
    c                   s"   e Zd Zdd„ Zd‡ fdd„	ZdS )zdoctest_for_module.<locals>.Cc             S   s   d S )N© )Úselfr   r   ú>/tmp/pip-build-7vycvbft/traits/traits/testing/doctest_tools.pyÚ
test_dummy8   s    z(doctest_for_module.<locals>.C.test_dummyNc                s2   t |dƒrtjˆ ƒj|jƒ ntjˆ ƒj|ƒ d S )NÚresult)ÚhasattrÚdoctestZDocTestSuiteÚrunr   )r   r   )Úmoduler   r   r	   ;   s    
z!doctest_for_module.<locals>.C.run)N)Ú__name__Ú
__module__Ú__qualname__r   r	   r   )r
   r   r   ÚC7   s   r   )ÚunittestZTestCase)r
   r   r   )r
   r   Údoctest_for_module   s     r   )Ú__doc__r   r   r   r   r   r   r   Ú<module>   s   