0.8.2: pytest is failing in `test/test_contrib/test_github_wiki.py::TestGithubWiki::test_parse` unit and `DeprecationWarning` warnings
See original GitHub issueI’m trying to package your module as an rpm package. So I’m using the typical PEP517 based build, install and test cycle used on building packages from non-root account.
python3 -sBm build -w --no-isolation
- because I’m calling
build
with--no-isolation
I’m using during all processes only locally installed modules - install .whl file in </install/prefix>
- run pytest with PYTHONPATH pointing to sitearch and sitelib inside </install/prefix>
Here is pytest output:
+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-mistletoe-0.8.2-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-mistletoe-0.8.2-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.13, pytest-7.1.1, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/mistletoe-0.8.2
collected 208 items
test/test_ast_renderer.py .. [ 0%]
test/test_block_token.py ..................................s........... [ 23%]
test/test_cli.py ............... [ 30%]
test/test_core_tokens.py ........... [ 35%]
test/test_html_renderer.py ............................. [ 49%]
test/test_latex_renderer.py ........................ [ 61%]
test/test_latex_token.py . [ 61%]
test/test_span_token.py .................... [ 71%]
test/test_traverse.py . [ 71%]
test/test_contrib/test_github_wiki.py F. [ 72%]
test/test_contrib/test_jira_renderer.py .................................. [ 88%]
test/test_contrib/test_mathjax.py .. [ 89%]
test/test_contrib/test_toc_renderer.py ...... [ 92%]
test/test_contrib/test_xwiki20_renderer.py ............... [100%]
================================================================================= FAILURES =================================================================================
________________________________________________________________________ TestGithubWiki.test_parse _________________________________________________________________________
self = <test.test_contrib.test_github_wiki.TestGithubWiki testMethod=test_parse>
def test_parse(self):
MockRawText = mock.Mock(autospec='mistletoe.span_token.RawText')
RawText = _token_types.pop()
_token_types.append(MockRawText)
try:
tokens = tokenize_inner('text with [[wiki | target]]')
token = tokens[1]
self.assertIsInstance(token, GithubWiki)
self.assertEqual(token.target, 'target')
> MockRawText.assert_has_calls([mock.call('text with '), mock.call('wiki')])
test/test_contrib/test_github_wiki.py:23:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Mock id='140376598689536'>, calls = [call('text with '), call('wiki')], any_order = False
def assert_has_calls(self, calls, any_order=False):
"""assert the mock has been called with the specified calls.
The `mock_calls` list is checked for the calls.
If `any_order` is False (the default) then the calls must be
sequential. There can be extra calls before or after the
specified calls.
If `any_order` is True then the calls can be in any order, but
they must all appear in `mock_calls`."""
expected = [self._call_matcher(c) for c in calls]
cause = next((e for e in expected if isinstance(e, Exception)), None)
all_calls = _CallList(self._call_matcher(c) for c in self.mock_calls)
if not any_order:
if expected not in all_calls:
if cause is None:
problem = 'Calls not found.'
else:
problem = ('Error processing expected calls.\n'
'Errors: {}').format(
[e if isinstance(e, Exception) else None
for e in expected])
> raise AssertionError(
f'{problem}\n'
f'Expected: {_CallList(calls)}'
f'{self._calls_repr(prefix="Actual").rstrip(".")}'
) from cause
E AssertionError: Calls not found.
E Expected: [call('text with '), call('wiki')]
/usr/lib64/python3.8/unittest/mock.py:950: AssertionError
============================================================================= warnings summary =============================================================================
test/test_span_token.py:102
/home/tkloczko/rpmbuild/BUILD/mistletoe-0.8.2/test/test_span_token.py:102: DeprecationWarning: invalid escape sequence \*
self._test_parse(span_token.EscapeSequence, '\*', '*')
test/test_span_token.py:105
/home/tkloczko/rpmbuild/BUILD/mistletoe-0.8.2/test/test_span_token.py:105: DeprecationWarning: invalid escape sequence \*
tokens = iter(span_token.tokenize_inner('some \*text*'))
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
========================================================================= short test summary info ==========================================================================
SKIPPED [1] test/test_block_token.py:309: Even GitHub fails in here, workaround: always put a space before `|`
FAILED test/test_contrib/test_github_wiki.py::TestGithubWiki::test_parse - AssertionError: Calls not found.
=========================================================== 1 failed, 206 passed, 1 skipped, 2 warnings in 0.68s ===========================================================
Issue Analytics
- State:
- Created a year ago
- Comments:5
Top Results From Across the Web
No results found
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
You can ask on pytest discussin forum https://github.com/pytest-dev/pytest/discussions
Fixed by #153, merged into master.