| 1 | From a885c54d54e71a089b916502f1c222ef14a07a93 Mon Sep 17 00:00:00 2001
|
| 2 | From: =?UTF-8?q?St=C3=A9phane=20Brunner?= <[email protected]>
|
| 3 | Date: Mon, 15 Aug 2022 10:41:40 +0200
|
| 4 | Subject: [PATCH] Fix the tests
|
| 5 |
|
| 6 | ---
|
| 7 | tests/test_sphinx_prompt.py | 12 +++++++++++-
|
| 8 | 1 file changed, 11 insertions(+), 1 deletion(-)
|
| 9 |
|
| 10 | diff --git a/tests/test_sphinx_prompt.py b/tests/test_sphinx_prompt.py
|
| 11 | index 47d16c5..6a31798 100644
|
| 12 | |
| 13 | |
| 14 | @@ -1,3 +1,7 @@
|
| 15 | +from io import StringIO
|
| 16 | +
|
| 17 | +import docutils.statemachine
|
| 18 | +import docutils.utils
|
| 19 | import pytest
|
| 20 |
|
| 21 | sphinx_prompt = __import__("sphinx_prompt")
|
| 22 | @@ -150,6 +154,12 @@
|
| 23 | def test(arguments, options, content, expected):
|
| 24 | sphinx_prompt._cache.next_index = 1
|
| 25 | sphinx_prompt._cache.prompts.clear()
|
| 26 | - directive = sphinx_prompt.PromptDirective("prompt", arguments, options, content, 0, 0, "", None, None)
|
| 27 | + stream = StringIO()
|
| 28 | + reporter = docutils.utils.Reporter("test data", 2, 4, stream, 1)
|
| 29 | + statemachine = docutils.statemachine.StateMachine([], None)
|
| 30 | + setattr(statemachine, "reporter", reporter)
|
| 31 | + directive = sphinx_prompt.PromptDirective(
|
| 32 | + "prompt", arguments, options, content, 0, 0, "", None, statemachine
|
| 33 | + )
|
| 34 | result = directive.run()
|
| 35 | assert result[0].astext() == expected
|