Skip to content

Commit

Permalink
Fix directive test on FreeBSD
Browse files Browse the repository at this point in the history
  • Loading branch information
Erotemic committed Aug 14, 2022
1 parent 3787f99 commit 6af2790
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/xdoctest/directive.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,21 +120,26 @@
Example:
>>> import sys
>>> plat = sys.platform
>>> count = 0
>>> # xdoctest: +REQUIRES(WIN32)
>>> assert sys.platform.startswith('win32')
>>> assert plat.startswith('win32'), 'this only runs on windows'
>>> count += 1
>>> # xdoctest: -REQUIRES(WIN32)
>>> # xdoctest: +REQUIRES(LINUX)
>>> assert sys.platform.startswith('linux')
>>> assert plat.startswith('linux'), 'this only runs on linux'
>>> count += 1
>>> # xdoctest: -REQUIRES(LINUX)
>>> # xdoctest: +REQUIRES(DARWIN)
>>> assert sys.platform.startswith('darwin')
>>> assert plat.startswith('darwin'), 'this only runs on osx'
>>> count += 1
>>> # xdoctest: -REQUIRES(DARWIN)
>>> print(count)
>>> assert count == 1, 'Exactly one of the above parts should have run'
>>> import sys
>>> if any(plat.startswith(n) for n in {'linux', 'win32', 'darwin'}):
>>> assert count == 1, 'Exactly one of the above parts should have run'
>>> else:
>>> assert count == 0, 'Nothing should have run on plat={}'.format(plat)
>>> # xdoctest: +REQUIRES(--verbose)
>>> print('This is only printed if you run with --verbose')
Expand Down Expand Up @@ -705,7 +710,8 @@ def _is_requires_satisfied(arg, argv=None, environ=None):
>>> _is_requires_satisfied('env:BAR>=1', argv=[], environ={'BAR': '0'})
"""
# TODO: add python version options
SYS_PLATFORM_TAGS = ['win32', 'linux', 'darwin', 'cywgin']
# https://docs.python.org/3/library/sys.html#sys.platform
SYS_PLATFORM_TAGS = ['win32', 'linux', 'darwin', 'cywgin', 'aix', 'freebsd']
OS_NAME_TAGS = ['posix', 'nt', 'java']
PY_IMPL_TAGS = ['cpython', 'ironpython', 'jython', 'pypy']
# TODO: tox tags: https://tox.readthedocs.io/en/latest/example/basic.html
Expand Down

0 comments on commit 6af2790

Please sign in to comment.