Update docs for :help tests.

This commit is contained in:
Florian Bruhin 2016-01-04 20:10:03 +01:00
parent 6eeb3fa32c
commit ea182934f3
2 changed files with 32 additions and 2 deletions

View File

@ -194,7 +194,8 @@ Feature: Various utility commands.
Then the error "Invalid help topic foo!" should be shown
Scenario: :help with command
When I run :tab-only
When the documentation is up to date
And I run :tab-only
And I run :help :back
And I wait until qute://help/commands.html#back is loaded
Then the following tabs should be open:
@ -205,7 +206,8 @@ Feature: Various utility commands.
Then the error "Invalid command foo!" should be shown
Scenario: :help with setting
When I run :tab-only
When the documentation is up to date
And I run :tab-only
And I run :help general->editor
And I wait until qute://help/settings.html#general-editor is loaded
Then the following tabs should be open:

View File

@ -17,5 +17,33 @@
# You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
import sys
import os.path
import subprocess
import pytest
import pytest_bdd as bdd
bdd.scenarios('misc.feature')
import qutebrowser
from qutebrowser.utils import docutils
@bdd.when("the documentation is up to date")
def update_documentation():
"""Update the docs before testing :help."""
base_path = os.path.dirname(os.path.abspath(qutebrowser.__file__))
doc_path = os.path.join(base_path, 'html', 'doc')
script_path = os.path.join(base_path, '..', 'scripts')
if all(docutils.docs_up_to_date(path) for path in os.listdir(doc_path)):
return
try:
subprocess.call(['asciidoc'], stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL)
except OSError:
pytest.skip("Docs outdated and asciidoc unavailable!")
update_script = os.path.join(script_path, 'asciidoc2html.py')
subprocess.call([sys.executable, update_script])