Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Erotemic committed Sep 5, 2022
1 parent 7c9cb7e commit d99af92
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 41 deletions.
1 change: 0 additions & 1 deletion src/xdoctest/directive.py
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,6 @@ def extract(cls, text):
False
"""
# Flag extracted directives as inline iff the text contains non-comments
print(f'text={text}')
inline = not all(line.strip().startswith('#')
for line in text.splitlines())
#
Expand Down
1 change: 0 additions & 1 deletion src/xdoctest/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,6 @@ def _group_labeled_lines(self, labeled_lines):
if current:
groups.append((state, current))

print(f'global_state.DEBUG_PARSER={global_state.DEBUG_PARSER}')
if global_state.DEBUG_PARSER > 4:
print('groups = {!r}'.format(groups))

Expand Down
1 change: 1 addition & 0 deletions src/xdoctest/utils/util_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,7 @@ def _syspath_modname_to_modpath(modname, sys_path=None, exclude=None):
>>> assert _syspath_modname_to_modpath('this', sys_path=[]) is None
Example:
>>> # xdoctest: +SKIP("dont test ourselves here)
>>> # test what happens when the module is not visible in the path
>>> modname = 'xdoctest.static_analysis'
>>> modpath = _syspath_modname_to_modpath(modname)
Expand Down
44 changes: 5 additions & 39 deletions tests/test_cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,34 +132,6 @@ def test_correct_skipping_on_decorators():
from xdoctest import runner
from os.path import join

source = utils.codeblock(
'''
import inspect
import sys
global_namespace = {} # type: ignore[var-annotated]
def dispatch(*types, **kwargs):
""" blah blah blah blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah
Examples
--------
>>> # xdoctest: +SKIP
>>> @dispatch(int)
... def f(x):
... return x + 1
>>> @dispatch(float)
... def f(x):
... return x - 1
>>> f(3)
4
>>> f(3.0)
2.0
"""
...
''')

source = utils.codeblock(
'''
def dispatch(*types, **kwargs):
Expand Down Expand Up @@ -187,11 +159,11 @@ def dispatch(*types, **kwargs):
'style': 'google',
}

xdoctest.global_state.DEBUG = 1
xdoctest.global_state.DEBUG_PARSER = 10
xdoctest.global_state.DEBUG_CORE = 1
xdoctest.global_state.DEBUG_RUNNER = 1
xdoctest.global_state.DEBUG_DOCTEST = 1
# xdoctest.global_state.DEBUG = 1
# xdoctest.global_state.DEBUG_PARSER = 10
# xdoctest.global_state.DEBUG_CORE = 1
# xdoctest.global_state.DEBUG_RUNNER = 1
# xdoctest.global_state.DEBUG_DOCTEST = 1

temp = utils.TempDir()
dpath = temp.ensure()
Expand All @@ -208,9 +180,3 @@ def dispatch(*types, **kwargs):
runner.doctest_module(modpath, 'all', argv=[''], config=config)
print(cap.text)
assert '1 skipped' in cap.text

# example = examples[0]
# print(example.format_src())
# example.run()

# temp.cleanup()

0 comments on commit d99af92

Please sign in to comment.