Erotemic / xdoctest

A rewrite of Python's builtin doctest module (with pytest plugin integration) with AST instead of REGEX.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The REQUIRES directive with multiple flags directive allows running of secondary parts

Erotemic opened this issue · comments

The following example works incorrectly:

>>> # xdoc: +REQUIRES(--flag1)
>>> a = 1
>>> # xdoc: +REQUIRES(--flag2)
>>> b = a

If you give it only --flag2 it will correctly not run the flag1 part, but then it incorrectly runs the flag2 part (which should still be under the influence of the flag1 REQUIRES directive).

More generally, it seems that current behavior only cares about the most recent directive. In the above example it doesn't matter how many false REQUIRES there are, as long as the last one is true it will still execute.

Fixed in #44