Skip to content
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

Doctests with multiple unsatisfied REQUIRES directives are not marked as skipped #88

Open
Erotemic opened this issue Oct 16, 2020 · 0 comments

Comments

@Erotemic
Copy link
Owner

Code to reproduce:

def demo_requires_skips_all_v1():
    """
    Example:
        >>> # xdoctest: +REQUIRES(--cliflag)
        >>> print('hello world')
    """


def demo_requires_skips_all_v2():
    """
    Example:
        >>> # xdoctest: +REQUIRES(module:xdoctest)
        >>> # xdoctest: +REQUIRES(--cliflag)
        >>> print('hello world')
    """


def demo():
    """
    CommandLine:

        # Correctly reports skipped (although an only skipped test report
        # should probably be yellow)
        xdoctest -m dev/demo_issues.py demo_requires_skips_all_v1

        # Incorrectly reports success
        xdoctest -m dev/demo_issues.py demo_requires_skips_all_v2

        # Correctly reports success
        xdoctest -m dev/demo_issues.py demo_requires_skips_all_v2 --cliflag

        # Correctly reports success
        xdoctest -m dev/demo_issues.py demo_requires_skips_all_v1 --cliflag
    """

    # Programatic reproduction (notice the first one also reports itself in
    # pytest mode which is also wrong)
    import xdoctest
    xdoctest.doctest_callable(demo_requires_skips_all_v1)
    xdoctest.doctest_callable(demo_requires_skips_all_v2)

    import sys, ubelt
    sys.path.append(ubelt.expandpath('~/code/xdoctest/dev'))
    import demo_issues

    # Correctly reports skipped
    xdoctest.doctest_module(demo_issues, command='demo_requires_skips_all_v1', argv=[])

    # Incorrectly reports passed
    xdoctest.doctest_module(demo_issues, command='demo_requires_skips_all_v2', argv=[])

    # argv not respected?
    xdoctest.doctest_module(demo_issues, command='demo_requires_skips_all_v1', argv=['--cliflag'])

    # argv not respected?
    xdoctest.doctest_module(demo_issues, command='demo_requires_skips_all_v2', argv=['--cliflag'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant