mirror of https://github.com/ansible/ansible.git
[stable-2.9] ansible-test - Pin rstcheck version. (#77584)
* ansible-test - Pin rstcheck version.
* ansible-test - Support newer Jinja2 versions for rstcheck sanity test.
(cherry picked from commit 5859e99a30)
Co-authored-by: Matt Clay <matt@mystile.com>
pull/77636/head
parent
1d8f9ce7d4
commit
1cc8f978f6
@ -0,0 +1,3 @@
|
||||
bugfixes:
|
||||
- ansible-test - Add ``rstcheck == 3.3.1`` constraint to avoid breaking changes in newer releases.
|
||||
- ansible-test - Support newer Jinja2 versions in the ``rstcheck`` sanity test.
|
||||
@ -0,0 +1,19 @@
|
||||
"""Wrapper around rstcheck to provide Jinja2 compatibility for Sphinx."""
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
import os
|
||||
import runpy
|
||||
import sys
|
||||
|
||||
try:
|
||||
from jinja2.filters import pass_context as _passctx, pass_environment as _passenv
|
||||
_mod = sys.modules['jinja2'] # pylint: disable=invalid-name
|
||||
_mod.contextfunction = _passctx
|
||||
_mod.environmentfilter = _passenv
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
sys.path.remove(os.path.dirname(__file__)) # avoid recursively running sanity test
|
||||
|
||||
runpy.run_module('rstcheck', run_name='__main__', alter_sys=True)
|
||||
Loading…
Reference in New Issue