From 826d30d52985dfe55ad7390786fcdd9c91c9397b Mon Sep 17 00:00:00 2001 From: Kostiantyn Goloveshko Date: Sun, 6 Oct 2024 23:08:08 +0300 Subject: [PATCH] Adjust Sphinx documentation --- AUTHORS.rst | 3 + CHANGES.rst | 3 + DOCUMENTATION.rst | 5 +- LICENSE.rst | 5 +- README.rst | 4 + docs/conf.py | 2 + docs/features.rst | 150 +++++++++++------------ docs/include.rst | 6 + docs/index.rst | 21 +--- src/pytest_bdd/script/bdd_tree_to_rst.py | 8 +- tests/doc/test_doc.py | 8 +- 11 files changed, 113 insertions(+), 102 deletions(-) create mode 100644 docs/include.rst diff --git a/AUTHORS.rst b/AUTHORS.rst index f6e810ac..0595de84 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -1,3 +1,6 @@ +.. toctree:: + :hidden: + Authors ======= diff --git a/CHANGES.rst b/CHANGES.rst index d3952941..24d577f3 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,6 @@ +.. toctree:: + :hidden: + Changelog ========= diff --git a/DOCUMENTATION.rst b/DOCUMENTATION.rst index c36518ec..7b1aec04 100644 --- a/DOCUMENTATION.rst +++ b/DOCUMENTATION.rst @@ -1,3 +1,6 @@ +.. toctree:: + :hidden: + Advanced Features ================= @@ -251,7 +254,7 @@ Allure reporting is also in place https://docs.qameta.io/allure and based on `allure-pytest` https://pypi.org/project/allure-pytest/ plugin. Usage is same. To install plugin -^^^^^^^^^^^^^^^^^ +################# :: diff --git a/LICENSE.rst b/LICENSE.rst index 6b536f27..98fa8dcb 100644 --- a/LICENSE.rst +++ b/LICENSE.rst @@ -1,7 +1,10 @@ +.. toctree:: + :hidden: + MIT License =========== -Copyright (C) 2013-2023 Oleg Pidsadnyi, Anatoly Bubenkov and others +Copyright (C) 2013-2024 Oleg Pidsadnyi, Anatoly Bubenkov and others Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: diff --git a/README.rst b/README.rst index a66ff3bc..53712b8a 100644 --- a/README.rst +++ b/README.rst @@ -72,6 +72,10 @@ The current pytest plugin for cucumber is pytest-bdd_ , a popular project with 1 - \- - \+ - No boilerplate code / No mix between steps definition and feature files + * - Load of Feature files by HTTP + - \- + - \+ + - Allows to integrate the library into external Feature storages * - Stability and bugfixes - \+ - \+/- diff --git a/docs/conf.py b/docs/conf.py index 079b708e..0c9357b0 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -101,6 +101,8 @@ # documentation. html_theme_options = { "page_width": "100%", + "sidebar_width": "270px", + "body_max_width": "1200%", } # Add any paths that contain custom themes here, relative to this directory. diff --git a/docs/features.rst b/docs/features.rst index 87532454..6c54439e 100644 --- a/docs/features.rst +++ b/docs/features.rst @@ -7,35 +7,11 @@ Features -Scenario --------- - -Description.feature -################### - -.. include:: ../features/Scenario/Description.feature - :code: gherkin - -Tag.feature -########### - -.. include:: ../features/Scenario/Tag.feature - :code: gherkin - -Outline -####### - -Examples Tag.feature -!!!!!!!!!!!!!!!!!!!! - -.. include:: ../features/Scenario/Outline/Examples Tag.feature - :code: gherkin - Tutorial -------- -Launch.feature -############## +Launch +###### .. include:: ../features/Tutorial/Launch.feature :code: gherkin @@ -43,47 +19,47 @@ Launch.feature Step definition --------------- -Target fixtures specification.feature -##################################### +Pytest fixtures substitution +############################ -.. include:: ../features/Step definition/Target fixtures specification.feature +.. include:: ../features/Step definition/Pytest fixtures substitution.feature :code: gherkin -Pytest fixtures substitution.feature -#################################### +Target fixtures specification +############################# -.. include:: ../features/Step definition/Pytest fixtures substitution.feature +.. include:: ../features/Step definition/Target fixtures specification.feature :code: gherkin Parameters ########## -Defaults.feature -!!!!!!!!!!!!!!!! +Conversion +!!!!!!!!!! -.. include:: ../features/Step definition/Parameters/Defaults.feature +.. include:: ../features/Step definition/Parameters/Conversion.feature :code: gherkin -Injection as fixtures.feature -!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +Defaults +!!!!!!!! -.. include:: ../features/Step definition/Parameters/Injection as fixtures.feature +.. include:: ../features/Step definition/Parameters/Defaults.feature :code: gherkin -Conversion.feature -!!!!!!!!!!!!!!!!!! +Injection as fixtures +!!!!!!!!!!!!!!!!!!!!! -.. include:: ../features/Step definition/Parameters/Conversion.feature +.. include:: ../features/Step definition/Parameters/Injection as fixtures.feature :code: gherkin -Parsing by custom parser.feature -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +Parsing by custom parser +!!!!!!!!!!!!!!!!!!!!!!!! .. include:: ../features/Step definition/Parameters/Parsing by custom parser.feature :code: gherkin -Parsing.feature -!!!!!!!!!!!!!!! +Parsing +!!!!!!! .. include:: ../features/Step definition/Parameters/Parsing.feature :code: gherkin @@ -91,47 +67,71 @@ Parsing.feature Step ---- -Doc string.feature -################## +Data table +########## -.. include:: ../features/Step/Doc string.feature +.. include:: ../features/Step/Data table.feature :code: gherkin -Data table.feature -################## +Doc string +########## -.. include:: ../features/Step/Data table.feature +.. include:: ../features/Step/Doc string.feature :code: gherkin -Step definition bounding.feature -################################ +Step definition bounding +######################## .. include:: ../features/Step/Step definition bounding.feature :code: gherkin +Scenario +-------- + +Description +########### + +.. include:: ../features/Scenario/Description.feature + :code: gherkin + +Tag +### + +.. include:: ../features/Scenario/Tag.feature + :code: gherkin + +Outline +####### + +Examples Tag +!!!!!!!!!!!! + +.. include:: ../features/Scenario/Outline/Examples Tag.feature + :code: gherkin + Feature ------- -Localization.feature -#################### +Description +########### -.. include:: ../features/Feature/Localization.feature +.. include:: ../features/Feature/Description.feature :code: gherkin -Description.feature -################### +Localization +############ -.. include:: ../features/Feature/Description.feature +.. include:: ../features/Feature/Localization.feature :code: gherkin -Tag conversion.feature -###################### +Tag conversion +############## .. include:: ../features/Feature/Tag conversion.feature :code: gherkin -Tag.feature -########### +Tag +### .. include:: ../features/Feature/Tag.feature :code: gherkin @@ -139,26 +139,26 @@ Tag.feature Load #### -Scenario search from base url.feature -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - -.. include:: ../features/Feature/Load/Scenario search from base url.feature - :code: gherkin - -Autoload.feature -!!!!!!!!!!!!!!!! +Autoload +!!!!!!!! .. include:: ../features/Feature/Load/Autoload.feature :code: gherkin -Scenario function loader.feature -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +Scenario function loader +!!!!!!!!!!!!!!!!!!!!!!!! .. include:: ../features/Feature/Load/Scenario function loader.feature :code: gherkin -Scenario search from base directory.feature -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +Scenario search from base directory +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. include:: ../features/Feature/Load/Scenario search from base directory.feature :code: gherkin + +Scenario search from base url +!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. include:: ../features/Feature/Load/Scenario search from base url.feature + :code: gherkin diff --git a/docs/include.rst b/docs/include.rst new file mode 100644 index 00000000..199589a6 --- /dev/null +++ b/docs/include.rst @@ -0,0 +1,6 @@ +.. include:: ../README.rst +.. include:: features.rst +.. include:: ../DOCUMENTATION.rst +.. include:: ../AUTHORS.rst +.. include:: ../CHANGES.rst +.. include:: ../LICENSE.rst diff --git a/docs/index.rst b/docs/index.rst index 8f61b204..3abcff1d 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,21 +1,8 @@ -.. toctree:: - :glob: - - * - Welcome to Pytest-BDD-NextGeneration's documentation! ===================================================== +.. toctree:: + :glob: -.. include:: ../README.rst - -.. contents:: - -.. include:: features.rst - -.. include:: ../DOCUMENTATION.rst - -.. include:: ../AUTHORS.rst - -.. include:: ../CHANGES.rst + include.rst -.. include:: ../LICENSE.rst +.. include:: include diff --git a/src/pytest_bdd/script/bdd_tree_to_rst.py b/src/pytest_bdd/script/bdd_tree_to_rst.py index 0ea09aa4..8a79e16a 100644 --- a/src/pytest_bdd/script/bdd_tree_to_rst.py +++ b/src/pytest_bdd/script/bdd_tree_to_rst.py @@ -64,8 +64,8 @@ def convert(features_path: Path, output_file_path: Path): content += dedent( # language=rst f"""\ - {rel_path.name} - {SECTION_SYMBOLS[len(rel_path.parts)-1]*len(rel_path.name)} + {rel_path.stem} + {SECTION_SYMBOLS[len(rel_path.parts)-1]*len(rel_path.stem)} .. include:: {(output_path_rel_to_features_path / path.relative_to(features_path)).as_posix()} :code: gherkin @@ -78,8 +78,8 @@ def convert(features_path: Path, output_file_path: Path): content += dedent( # language=rst f"""\ - {rel_path.as_posix()} - {SECTION_SYMBOLS[len(rel_path.parts)-1]*len(str(rel_path))} + {rel_path.stem} + {SECTION_SYMBOLS[len(rel_path.parts)-1]*len(rel_path.stem)} .. include:: {(output_path_rel_to_features_path / path.relative_to(features_path)).as_posix()} :code: yaml diff --git a/tests/doc/test_doc.py b/tests/doc/test_doc.py index b00adeb7..3af3f176 100644 --- a/tests/doc/test_doc.py +++ b/tests/doc/test_doc.py @@ -41,8 +41,8 @@ def test_doc_generation(testdir: "Testdir"): - simple.gherkin - -------------- + simple + ------ .. include:: features/simple.gherkin :code: gherkin @@ -50,8 +50,8 @@ def test_doc_generation(testdir: "Testdir"): extra ----- - other_simple.gherkin - #################### + other_simple + ############ .. include:: features/extra/other_simple.gherkin :code: gherkin