├── .circleci ├── .gitignore └── config.yml ├── .gitignore ├── .readthedocs.yaml ├── LICENSE ├── README.rst ├── changelog.rst ├── docs ├── Makefile ├── _themes │ ├── .gitignore │ ├── LICENSE │ ├── README │ ├── flask │ │ ├── layout.html │ │ ├── relations.html │ │ ├── static │ │ │ └── flasky.css_t │ │ └── theme.conf │ ├── flask_small │ │ ├── layout.html │ │ ├── static │ │ │ └── flasky.css_t │ │ └── theme.conf │ └── flask_theme_support.py ├── conf.py ├── index.rst └── requirements.txt ├── flask_webtest.py ├── mise.toml ├── pyp.ini ├── requirements-dev.txt ├── setup.cfg ├── setup.py ├── stable-requirements.txt ├── test.sh ├── tests ├── __init__.py ├── core.py ├── core_sqlalchemy.py ├── templates │ ├── extra-template.html │ └── template.html └── test.py ├── tox.ini └── version.py /.circleci/.gitignore: -------------------------------------------------------------------------------- 1 | artifacts 2 | test-reports 3 | -------------------------------------------------------------------------------- /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | jobs: 3 | build: 4 | docker: 5 | - image: level12/python-test-multi 6 | steps: 7 | - checkout 8 | 9 | - run: 10 | name: folder listing for debugging 11 | command: ls -al 12 | 13 | - run: 14 | name: install tox 15 | command: python3.10 -m pip install tox 16 | 17 | - run: 18 | name: version checks 19 | command: | 20 | python3.10 --version 21 | tox --version 22 | 23 | - run: 24 | name: run tox 25 | command: tox 26 | 27 | - store_test_results: 28 | path: .circleci/test-reports/ 29 | 30 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | docs/_build 2 | Flask_WebTest.egg-info 3 | __pycache__ 4 | tests/__pycache__ 5 | build 6 | dist 7 | .tox 8 | -------------------------------------------------------------------------------- /.readthedocs.yaml: -------------------------------------------------------------------------------- 1 | # .readthedocs.yaml 2 | # Read the Docs configuration file 3 | # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details 4 | 5 | # Required 6 | version: 2 7 | 8 | # Set the version of Python and other tools you might need 9 | build: 10 | os: ubuntu-22.04 11 | tools: 12 | python: "3.11" 13 | 14 | # Build documentation in the docs/ directory with Sphinx 15 | sphinx: 16 | configuration: docs/conf.py 17 | 18 | # We recommend specifying your dependencies to enable reproducible builds: 19 | # https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html 20 | python: 21 | install: 22 | - requirements: docs/requirements.txt 23 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 by Anton Romanovich. 2 | 3 | Some rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are 7 | met: 8 | 9 | * Redistributions of source code must retain the above copyright 10 | notice, this list of conditions and the following disclaimer. 11 | 12 | * Redistributions in binary form must reproduce the above 13 | copyright notice, this list of conditions and the following 14 | disclaimer in the documentation and/or other materials provided 15 | with the distribution. 16 | 17 | * The names of the contributors may not be used to endorse or 18 | promote products derived from this software without specific 19 | prior written permission. 20 | 21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | Flask-WebTest 2 | ============= 3 | 4 | .. image:: https://dl.circleci.com/status-badge/img/gh/level12/flask-webtest/tree/master.svg?style=svg 5 | :target: https://dl.circleci.com/status-badge/redirect/gh/level12/flask-webtest/tree/master 6 | 7 | Flask-WebTest provides a set of utilities to ease testing Flask applications with WebTest. 8 | 9 | As a small-in-scope project and relatively mature/stable, lack of recent commits does not indicate 10 | it is abandoned. Occasionally, Flask or another dependency will deprecate imports. Most updates 11 | here will be to resolve those breakages when they occur. 12 | 13 | 14 | Installation 15 | ------------ 16 | 17 | ``pip install flask-webtest`` 18 | 19 | Documentation 20 | ------------- 21 | 22 | Documentation is available on `Read the Docs`_. 23 | 24 | .. _Read the Docs: https://flask-webtest.readthedocs.org/en/latest/ 25 | -------------------------------------------------------------------------------- /changelog.rst: -------------------------------------------------------------------------------- 1 | Changelog 2 | ========= 3 | 4 | 0.1.6 released 2024-08-22 5 | ------------------------- 6 | 7 | - Really fix bug with session_transaction() and localhost (683dd33_) 8 | 9 | .. _683dd33: https://github.com/level12/flask-webtest/commit/683dd33 10 | 11 | 12 | 0.1.5 released 2024-08-22 13 | ------------------------- 14 | 15 | - Fix bug with session_transaction() and localhost (c584434_) 16 | - Add mise & update tested python versions (e1bfdde_) 17 | 18 | .. _c584434: https://github.com/level12/flask-webtest/commit/c584434 19 | .. _e1bfdde: https://github.com/level12/flask-webtest/commit/e1bfdde 20 | 21 | 22 | 0.1.4 released 2023-11-10 23 | ------------------------- 24 | 25 | - update fork target in docs (15b4cd1_) 26 | - add config file for ReadTheDocs (b55cb4c_) 27 | - fix docs URLs and print statements (thanks @azmeuk) (e233fc2_) 28 | - support flask 3 (602f329_) 29 | 30 | .. _15b4cd1: https://github.com/level12/flask-webtest/commit/15b4cd1 31 | .. _b55cb4c: https://github.com/level12/flask-webtest/commit/b55cb4c 32 | .. _e233fc2: https://github.com/level12/flask-webtest/commit/e233fc2 33 | .. _602f329: https://github.com/level12/flask-webtest/commit/602f329 34 | 35 | 36 | 0.1.3 released 2023-05-12 37 | ------------------------- 38 | 39 | - support flask 2.3 cookie domain handling (96c18d1_) 40 | 41 | .. _96c18d1: https://github.com/level12/flask-webtest/commit/96c18d1 42 | 43 | 44 | 0.1.2 released 2023-05-12 45 | ------------------------- 46 | 47 | - support werkzeug 2.3 refactored cookies (104ce84_) 48 | 49 | .. _104ce84: https://github.com/level12/flask-webtest/commit/104ce84 50 | 51 | 52 | 0.1.1 released 2023-03-02 53 | ------------------------- 54 | 55 | - fix package definition (65c73aa_) 56 | 57 | .. _65c73aa: https://github.com/level12/flask-webtest/commit/65c73aa 58 | 59 | 60 | 0.1.0 released 2023-03-02 61 | ------------------------- 62 | 63 | - update readme to note stability and change CI badge (59d7d01_) 64 | - fix babel issue for docs build (40be72f_) 65 | - set up CI environment (0a2a76c_) 66 | - resolve test suite breakage (2ff3581_) 67 | - push an app context on each request, based on config (88d7251_) 68 | - update to support flask-sqlalchemy 2.5+ (f7cc4d4_) 69 | 70 | .. _59d7d01: https://github.com/level12/flask-webtest/commit/59d7d01 71 | .. _40be72f: https://github.com/level12/flask-webtest/commit/40be72f 72 | .. _0a2a76c: https://github.com/level12/flask-webtest/commit/0a2a76c 73 | .. _2ff3581: https://github.com/level12/flask-webtest/commit/2ff3581 74 | .. _88d7251: https://github.com/level12/flask-webtest/commit/88d7251 75 | .. _f7cc4d4: https://github.com/level12/flask-webtest/commit/f7cc4d4 76 | -------------------------------------------------------------------------------- /docs/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line. 5 | SPHINXOPTS = 6 | SPHINXBUILD = sphinx-build 7 | PAPER = 8 | BUILDDIR = _build 9 | 10 | # User-friendly check for sphinx-build 11 | ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1) 12 | $(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/) 13 | endif 14 | 15 | # Internal variables. 16 | PAPEROPT_a4 = -D latex_paper_size=a4 17 | PAPEROPT_letter = -D latex_paper_size=letter 18 | ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . 19 | # the i18n builder cannot share the environment and doctrees with the others 20 | I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . 21 | 22 | .PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext 23 | 24 | help: 25 | @echo "Please use \`make ' where is one of" 26 | @echo " html to make standalone HTML files" 27 | @echo " dirhtml to make HTML files named index.html in directories" 28 | @echo " singlehtml to make a single large HTML file" 29 | @echo " pickle to make pickle files" 30 | @echo " json to make JSON files" 31 | @echo " htmlhelp to make HTML files and a HTML help project" 32 | @echo " qthelp to make HTML files and a qthelp project" 33 | @echo " devhelp to make HTML files and a Devhelp project" 34 | @echo " epub to make an epub" 35 | @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" 36 | @echo " latexpdf to make LaTeX files and run them through pdflatex" 37 | @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx" 38 | @echo " text to make text files" 39 | @echo " man to make manual pages" 40 | @echo " texinfo to make Texinfo files" 41 | @echo " info to make Texinfo files and run them through makeinfo" 42 | @echo " gettext to make PO message catalogs" 43 | @echo " changes to make an overview of all changed/added/deprecated items" 44 | @echo " xml to make Docutils-native XML files" 45 | @echo " pseudoxml to make pseudoxml-XML files for display purposes" 46 | @echo " linkcheck to check all external links for integrity" 47 | @echo " doctest to run all doctests embedded in the documentation (if enabled)" 48 | 49 | clean: 50 | rm -rf $(BUILDDIR)/* 51 | 52 | html: 53 | $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html 54 | @echo 55 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." 56 | 57 | dirhtml: 58 | $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml 59 | @echo 60 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." 61 | 62 | singlehtml: 63 | $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml 64 | @echo 65 | @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." 66 | 67 | pickle: 68 | $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle 69 | @echo 70 | @echo "Build finished; now you can process the pickle files." 71 | 72 | json: 73 | $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json 74 | @echo 75 | @echo "Build finished; now you can process the JSON files." 76 | 77 | htmlhelp: 78 | $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp 79 | @echo 80 | @echo "Build finished; now you can run HTML Help Workshop with the" \ 81 | ".hhp project file in $(BUILDDIR)/htmlhelp." 82 | 83 | qthelp: 84 | $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp 85 | @echo 86 | @echo "Build finished; now you can run "qcollectiongenerator" with the" \ 87 | ".qhcp project file in $(BUILDDIR)/qthelp, like this:" 88 | @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/Flask-WebTest.qhcp" 89 | @echo "To view the help file:" 90 | @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/Flask-WebTest.qhc" 91 | 92 | devhelp: 93 | $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp 94 | @echo 95 | @echo "Build finished." 96 | @echo "To view the help file:" 97 | @echo "# mkdir -p $$HOME/.local/share/devhelp/Flask-WebTest" 98 | @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/Flask-WebTest" 99 | @echo "# devhelp" 100 | 101 | epub: 102 | $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub 103 | @echo 104 | @echo "Build finished. The epub file is in $(BUILDDIR)/epub." 105 | 106 | latex: 107 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 108 | @echo 109 | @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." 110 | @echo "Run \`make' in that directory to run these through (pdf)latex" \ 111 | "(use \`make latexpdf' here to do that automatically)." 112 | 113 | latexpdf: 114 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 115 | @echo "Running LaTeX files through pdflatex..." 116 | $(MAKE) -C $(BUILDDIR)/latex all-pdf 117 | @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." 118 | 119 | latexpdfja: 120 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 121 | @echo "Running LaTeX files through platex and dvipdfmx..." 122 | $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja 123 | @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." 124 | 125 | text: 126 | $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text 127 | @echo 128 | @echo "Build finished. The text files are in $(BUILDDIR)/text." 129 | 130 | man: 131 | $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man 132 | @echo 133 | @echo "Build finished. The manual pages are in $(BUILDDIR)/man." 134 | 135 | texinfo: 136 | $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo 137 | @echo 138 | @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." 139 | @echo "Run \`make' in that directory to run these through makeinfo" \ 140 | "(use \`make info' here to do that automatically)." 141 | 142 | info: 143 | $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo 144 | @echo "Running Texinfo files through makeinfo..." 145 | make -C $(BUILDDIR)/texinfo info 146 | @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." 147 | 148 | gettext: 149 | $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale 150 | @echo 151 | @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." 152 | 153 | changes: 154 | $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes 155 | @echo 156 | @echo "The overview file is in $(BUILDDIR)/changes." 157 | 158 | linkcheck: 159 | $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck 160 | @echo 161 | @echo "Link check complete; look for any errors in the above output " \ 162 | "or in $(BUILDDIR)/linkcheck/output.txt." 163 | 164 | doctest: 165 | $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest 166 | @echo "Testing of doctests in the sources finished, look at the " \ 167 | "results in $(BUILDDIR)/doctest/output.txt." 168 | 169 | xml: 170 | $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml 171 | @echo 172 | @echo "Build finished. The XML files are in $(BUILDDIR)/xml." 173 | 174 | pseudoxml: 175 | $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml 176 | @echo 177 | @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml." 178 | -------------------------------------------------------------------------------- /docs/_themes/.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | *.pyo 3 | .DS_Store 4 | -------------------------------------------------------------------------------- /docs/_themes/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010 by Armin Ronacher. 2 | 3 | Some rights reserved. 4 | 5 | Redistribution and use in source and binary forms of the theme, with or 6 | without modification, are permitted provided that the following conditions 7 | are met: 8 | 9 | * Redistributions of source code must retain the above copyright 10 | notice, this list of conditions and the following disclaimer. 11 | 12 | * Redistributions in binary form must reproduce the above 13 | copyright notice, this list of conditions and the following 14 | disclaimer in the documentation and/or other materials provided 15 | with the distribution. 16 | 17 | * The names of the contributors may not be used to endorse or 18 | promote products derived from this software without specific 19 | prior written permission. 20 | 21 | We kindly ask you to only use these themes in an unmodified manner just 22 | for Flask and Flask-related products, not for unrelated projects. If you 23 | like the visual style and want to use it for your own projects, please 24 | consider making some larger changes to the themes (such as changing 25 | font faces, sizes, colors or margins). 26 | 27 | THIS THEME IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 28 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 29 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 30 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 31 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 32 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 33 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 34 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 35 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 36 | ARISING IN ANY WAY OUT OF THE USE OF THIS THEME, EVEN IF ADVISED OF THE 37 | POSSIBILITY OF SUCH DAMAGE. 38 | -------------------------------------------------------------------------------- /docs/_themes/README: -------------------------------------------------------------------------------- 1 | Flask Sphinx Styles 2 | =================== 3 | 4 | This repository contains sphinx styles for Flask and Flask related 5 | projects. To use this style in your Sphinx documentation, follow 6 | this guide: 7 | 8 | 1. put this folder as _themes into your docs folder. Alternatively 9 | you can also use git submodules to check out the contents there. 10 | 2. add this to your conf.py: 11 | 12 | sys.path.append(os.path.abspath('_themes')) 13 | html_theme_path = ['_themes'] 14 | html_theme = 'flask' 15 | 16 | The following themes exist: 17 | 18 | - 'flask' - the standard flask documentation theme for large 19 | projects 20 | - 'flask_small' - small one-page theme. Intended to be used by 21 | very small addon libraries for flask. 22 | 23 | The following options exist for the flask_small theme: 24 | 25 | [options] 26 | index_logo = '' filename of a picture in _static 27 | to be used as replacement for the 28 | h1 in the index.rst file. 29 | index_logo_height = 120px height of the index logo 30 | github_fork = '' repository name on github for the 31 | "fork me" badge 32 | -------------------------------------------------------------------------------- /docs/_themes/flask/layout.html: -------------------------------------------------------------------------------- 1 | {%- extends "basic/layout.html" %} 2 | {%- block extrahead %} 3 | {{ super() }} 4 | {% if theme_touch_icon %} 5 | 6 | {% endif %} 7 | 8 | {% endblock %} 9 | {%- block relbar2 %}{% endblock %} 10 | {% block header %} 11 | {{ super() }} 12 | {% if pagename == 'index' %} 13 |
14 | {% endif %} 15 | {% endblock %} 16 | {%- block footer %} 17 | 21 | {% if pagename == 'index' %} 22 |
23 | {% endif %} 24 | {%- endblock %} 25 | -------------------------------------------------------------------------------- /docs/_themes/flask/relations.html: -------------------------------------------------------------------------------- 1 |

Related Topics

2 | 20 | -------------------------------------------------------------------------------- /docs/_themes/flask/static/flasky.css_t: -------------------------------------------------------------------------------- 1 | /* 2 | * flasky.css_t 3 | * ~~~~~~~~~~~~ 4 | * 5 | * :copyright: Copyright 2010 by Armin Ronacher. 6 | * :license: Flask Design License, see LICENSE for details. 7 | */ 8 | 9 | {% set page_width = '940px' %} 10 | {% set sidebar_width = '220px' %} 11 | 12 | @import url("basic.css"); 13 | 14 | /* -- page layout ----------------------------------------------------------- */ 15 | 16 | body { 17 | font-family: 'Georgia', serif; 18 | font-size: 17px; 19 | background-color: white; 20 | color: #000; 21 | margin: 0; 22 | padding: 0; 23 | } 24 | 25 | div.document { 26 | width: {{ page_width }}; 27 | margin: 30px auto 0 auto; 28 | } 29 | 30 | div.documentwrapper { 31 | float: left; 32 | width: 100%; 33 | } 34 | 35 | div.bodywrapper { 36 | margin: 0 0 0 {{ sidebar_width }}; 37 | } 38 | 39 | div.sphinxsidebar { 40 | width: {{ sidebar_width }}; 41 | } 42 | 43 | hr { 44 | border: 1px solid #B1B4B6; 45 | } 46 | 47 | div.body { 48 | background-color: #ffffff; 49 | color: #3E4349; 50 | padding: 0 30px 0 30px; 51 | } 52 | 53 | img.floatingflask { 54 | padding: 0 0 10px 10px; 55 | float: right; 56 | } 57 | 58 | div.footer { 59 | width: {{ page_width }}; 60 | margin: 20px auto 30px auto; 61 | font-size: 14px; 62 | color: #888; 63 | text-align: right; 64 | } 65 | 66 | div.footer a { 67 | color: #888; 68 | } 69 | 70 | div.related { 71 | display: none; 72 | } 73 | 74 | div.sphinxsidebar a { 75 | color: #444; 76 | text-decoration: none; 77 | border-bottom: 1px dotted #999; 78 | } 79 | 80 | div.sphinxsidebar a:hover { 81 | border-bottom: 1px solid #999; 82 | } 83 | 84 | div.sphinxsidebar { 85 | font-size: 14px; 86 | line-height: 1.5; 87 | } 88 | 89 | div.sphinxsidebarwrapper { 90 | padding: 18px 10px; 91 | } 92 | 93 | div.sphinxsidebarwrapper p.logo { 94 | padding: 0 0 20px 0; 95 | margin: 0; 96 | text-align: center; 97 | } 98 | 99 | div.sphinxsidebar h3, 100 | div.sphinxsidebar h4 { 101 | font-family: 'Garamond', 'Georgia', serif; 102 | color: #444; 103 | font-size: 24px; 104 | font-weight: normal; 105 | margin: 0 0 5px 0; 106 | padding: 0; 107 | } 108 | 109 | div.sphinxsidebar h4 { 110 | font-size: 20px; 111 | } 112 | 113 | div.sphinxsidebar h3 a { 114 | color: #444; 115 | } 116 | 117 | div.sphinxsidebar p.logo a, 118 | div.sphinxsidebar h3 a, 119 | div.sphinxsidebar p.logo a:hover, 120 | div.sphinxsidebar h3 a:hover { 121 | border: none; 122 | } 123 | 124 | div.sphinxsidebar p { 125 | color: #555; 126 | margin: 10px 0; 127 | } 128 | 129 | div.sphinxsidebar ul { 130 | margin: 10px 0; 131 | padding: 0; 132 | color: #000; 133 | } 134 | 135 | div.sphinxsidebar input { 136 | border: 1px solid #ccc; 137 | font-family: 'Georgia', serif; 138 | font-size: 1em; 139 | } 140 | 141 | /* -- body styles ----------------------------------------------------------- */ 142 | 143 | a { 144 | color: #004B6B; 145 | text-decoration: underline; 146 | } 147 | 148 | a:hover { 149 | color: #6D4100; 150 | text-decoration: underline; 151 | } 152 | 153 | div.body h1, 154 | div.body h2, 155 | div.body h3, 156 | div.body h4, 157 | div.body h5, 158 | div.body h6 { 159 | font-family: 'Garamond', 'Georgia', serif; 160 | font-weight: normal; 161 | margin: 30px 0px 10px 0px; 162 | padding: 0; 163 | } 164 | 165 | {% if theme_index_logo %} 166 | div.indexwrapper h1 { 167 | text-indent: -999999px; 168 | background: url({{ theme_index_logo }}) no-repeat center center; 169 | height: {{ theme_index_logo_height }}; 170 | } 171 | {% endif %} 172 | div.body h1 { margin-top: 0; padding-top: 0; font-size: 240%; } 173 | div.body h2 { font-size: 180%; } 174 | div.body h3 { font-size: 150%; } 175 | div.body h4 { font-size: 130%; } 176 | div.body h5 { font-size: 100%; } 177 | div.body h6 { font-size: 100%; } 178 | 179 | a.headerlink { 180 | color: #ddd; 181 | padding: 0 4px; 182 | text-decoration: none; 183 | } 184 | 185 | a.headerlink:hover { 186 | color: #444; 187 | background: #eaeaea; 188 | } 189 | 190 | div.body p, div.body dd, div.body li { 191 | line-height: 1.4em; 192 | } 193 | 194 | div.admonition { 195 | background: #fafafa; 196 | margin: 20px -30px; 197 | padding: 10px 30px; 198 | border-top: 1px solid #ccc; 199 | border-bottom: 1px solid #ccc; 200 | } 201 | 202 | div.admonition tt.xref, div.admonition a tt { 203 | border-bottom: 1px solid #fafafa; 204 | } 205 | 206 | dd div.admonition { 207 | margin-left: -60px; 208 | padding-left: 60px; 209 | } 210 | 211 | div.admonition p.admonition-title { 212 | font-family: 'Garamond', 'Georgia', serif; 213 | font-weight: normal; 214 | font-size: 24px; 215 | margin: 0 0 10px 0; 216 | padding: 0; 217 | line-height: 1; 218 | } 219 | 220 | div.admonition p.last { 221 | margin-bottom: 0; 222 | } 223 | 224 | div.highlight { 225 | background-color: white; 226 | } 227 | 228 | dt:target, .highlight { 229 | background: #FAF3E8; 230 | } 231 | 232 | div.note { 233 | background-color: #eee; 234 | border: 1px solid #ccc; 235 | } 236 | 237 | div.seealso { 238 | background-color: #ffc; 239 | border: 1px solid #ff6; 240 | } 241 | 242 | div.topic { 243 | background-color: #eee; 244 | } 245 | 246 | p.admonition-title { 247 | display: inline; 248 | } 249 | 250 | p.admonition-title:after { 251 | content: ":"; 252 | } 253 | 254 | pre, tt { 255 | font-family: 'Consolas', 'Menlo', 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace; 256 | font-size: 0.9em; 257 | } 258 | 259 | img.screenshot { 260 | } 261 | 262 | tt.descname, tt.descclassname { 263 | font-size: 0.95em; 264 | } 265 | 266 | tt.descname { 267 | padding-right: 0.08em; 268 | } 269 | 270 | img.screenshot { 271 | -moz-box-shadow: 2px 2px 4px #eee; 272 | -webkit-box-shadow: 2px 2px 4px #eee; 273 | box-shadow: 2px 2px 4px #eee; 274 | } 275 | 276 | table.docutils { 277 | border: 1px solid #888; 278 | -moz-box-shadow: 2px 2px 4px #eee; 279 | -webkit-box-shadow: 2px 2px 4px #eee; 280 | box-shadow: 2px 2px 4px #eee; 281 | } 282 | 283 | table.docutils td, table.docutils th { 284 | border: 1px solid #888; 285 | padding: 0.25em 0.7em; 286 | } 287 | 288 | table.field-list, table.footnote { 289 | border: none; 290 | -moz-box-shadow: none; 291 | -webkit-box-shadow: none; 292 | box-shadow: none; 293 | } 294 | 295 | table.footnote { 296 | margin: 15px 0; 297 | width: 100%; 298 | border: 1px solid #eee; 299 | background: #fdfdfd; 300 | font-size: 0.9em; 301 | } 302 | 303 | table.footnote + table.footnote { 304 | margin-top: -15px; 305 | border-top: none; 306 | } 307 | 308 | table.field-list th { 309 | padding: 0 0.8em 0 0; 310 | } 311 | 312 | table.field-list td { 313 | padding: 0; 314 | } 315 | 316 | table.footnote td.label { 317 | width: 0px; 318 | padding: 0.3em 0 0.3em 0.5em; 319 | } 320 | 321 | table.footnote td { 322 | padding: 0.3em 0.5em; 323 | } 324 | 325 | dl { 326 | margin: 0; 327 | padding: 0; 328 | } 329 | 330 | dl dd { 331 | margin-left: 30px; 332 | } 333 | 334 | blockquote { 335 | margin: 0 0 0 30px; 336 | padding: 0; 337 | } 338 | 339 | ul, ol { 340 | margin: 10px 0 10px 30px; 341 | padding: 0; 342 | } 343 | 344 | pre { 345 | background: #eee; 346 | padding: 7px 30px; 347 | margin: 15px -30px; 348 | line-height: 1.3em; 349 | } 350 | 351 | dl pre, blockquote pre, li pre { 352 | margin-left: -60px; 353 | padding-left: 60px; 354 | } 355 | 356 | dl dl pre { 357 | margin-left: -90px; 358 | padding-left: 90px; 359 | } 360 | 361 | tt { 362 | background-color: #ecf0f3; 363 | color: #222; 364 | /* padding: 1px 2px; */ 365 | } 366 | 367 | tt.xref, a tt { 368 | background-color: #FBFBFB; 369 | border-bottom: 1px solid white; 370 | } 371 | 372 | a.reference { 373 | text-decoration: none; 374 | border-bottom: 1px dotted #004B6B; 375 | } 376 | 377 | a.reference:hover { 378 | border-bottom: 1px solid #6D4100; 379 | } 380 | 381 | a.footnote-reference { 382 | text-decoration: none; 383 | font-size: 0.7em; 384 | vertical-align: top; 385 | border-bottom: 1px dotted #004B6B; 386 | } 387 | 388 | a.footnote-reference:hover { 389 | border-bottom: 1px solid #6D4100; 390 | } 391 | 392 | a:hover tt { 393 | background: #EEE; 394 | } 395 | 396 | 397 | @media screen and (max-width: 870px) { 398 | 399 | div.sphinxsidebar { 400 | display: none; 401 | } 402 | 403 | div.document { 404 | width: 100%; 405 | 406 | } 407 | 408 | div.documentwrapper { 409 | margin-left: 0; 410 | margin-top: 0; 411 | margin-right: 0; 412 | margin-bottom: 0; 413 | } 414 | 415 | div.bodywrapper { 416 | margin-top: 0; 417 | margin-right: 0; 418 | margin-bottom: 0; 419 | margin-left: 0; 420 | } 421 | 422 | ul { 423 | margin-left: 0; 424 | } 425 | 426 | .document { 427 | width: auto; 428 | } 429 | 430 | .footer { 431 | width: auto; 432 | } 433 | 434 | .bodywrapper { 435 | margin: 0; 436 | } 437 | 438 | .footer { 439 | width: auto; 440 | } 441 | 442 | .github { 443 | display: none; 444 | } 445 | 446 | 447 | 448 | } 449 | 450 | 451 | 452 | @media screen and (max-width: 875px) { 453 | 454 | body { 455 | margin: 0; 456 | padding: 20px 30px; 457 | } 458 | 459 | div.documentwrapper { 460 | float: none; 461 | background: white; 462 | } 463 | 464 | div.sphinxsidebar { 465 | display: block; 466 | float: none; 467 | width: 102.5%; 468 | margin: 50px -30px -20px -30px; 469 | padding: 10px 20px; 470 | background: #333; 471 | color: white; 472 | } 473 | 474 | div.sphinxsidebar h3, div.sphinxsidebar h4, div.sphinxsidebar p, 475 | div.sphinxsidebar h3 a { 476 | color: white; 477 | } 478 | 479 | div.sphinxsidebar a { 480 | color: #aaa; 481 | } 482 | 483 | div.sphinxsidebar p.logo { 484 | display: none; 485 | } 486 | 487 | div.document { 488 | width: 100%; 489 | margin: 0; 490 | } 491 | 492 | div.related { 493 | display: block; 494 | margin: 0; 495 | padding: 10px 0 20px 0; 496 | } 497 | 498 | div.related ul, 499 | div.related ul li { 500 | margin: 0; 501 | padding: 0; 502 | } 503 | 504 | div.footer { 505 | display: none; 506 | } 507 | 508 | div.bodywrapper { 509 | margin: 0; 510 | } 511 | 512 | div.body { 513 | min-height: 0; 514 | padding: 0; 515 | } 516 | 517 | .rtd_doc_footer { 518 | display: none; 519 | } 520 | 521 | .document { 522 | width: auto; 523 | } 524 | 525 | .footer { 526 | width: auto; 527 | } 528 | 529 | .footer { 530 | width: auto; 531 | } 532 | 533 | .github { 534 | display: none; 535 | } 536 | } 537 | 538 | 539 | /* scrollbars */ 540 | 541 | ::-webkit-scrollbar { 542 | width: 6px; 543 | height: 6px; 544 | } 545 | 546 | ::-webkit-scrollbar-button:start:decrement, 547 | ::-webkit-scrollbar-button:end:increment { 548 | display: block; 549 | height: 10px; 550 | } 551 | 552 | ::-webkit-scrollbar-button:vertical:increment { 553 | background-color: #fff; 554 | } 555 | 556 | ::-webkit-scrollbar-track-piece { 557 | background-color: #eee; 558 | -webkit-border-radius: 3px; 559 | } 560 | 561 | ::-webkit-scrollbar-thumb:vertical { 562 | height: 50px; 563 | background-color: #ccc; 564 | -webkit-border-radius: 3px; 565 | } 566 | 567 | ::-webkit-scrollbar-thumb:horizontal { 568 | width: 50px; 569 | background-color: #ccc; 570 | -webkit-border-radius: 3px; 571 | } 572 | 573 | /* misc. */ 574 | 575 | .revsys-inline { 576 | display: none!important; 577 | } -------------------------------------------------------------------------------- /docs/_themes/flask/theme.conf: -------------------------------------------------------------------------------- 1 | [theme] 2 | inherit = basic 3 | stylesheet = flasky.css 4 | pygments_style = flask_theme_support.FlaskyStyle 5 | 6 | [options] 7 | index_logo = '' 8 | index_logo_height = 120px 9 | touch_icon = 10 | -------------------------------------------------------------------------------- /docs/_themes/flask_small/layout.html: -------------------------------------------------------------------------------- 1 | {% extends "basic/layout.html" %} 2 | {% block header %} 3 | {{ super() }} 4 | {% if pagename == 'index' %} 5 |
6 | {% endif %} 7 | {% endblock %} 8 | {% block footer %} 9 | {% if pagename == 'index' %} 10 |
11 | {% endif %} 12 | {% endblock %} 13 | {# do not display relbars #} 14 | {% block relbar1 %}{% endblock %} 15 | {% block relbar2 %} 16 | {% if theme_github_fork %} 17 | Fork me on GitHub 19 | {% endif %} 20 | {% endblock %} 21 | {% block sidebar1 %}{% endblock %} 22 | {% block sidebar2 %}{% endblock %} 23 | -------------------------------------------------------------------------------- /docs/_themes/flask_small/static/flasky.css_t: -------------------------------------------------------------------------------- 1 | /* 2 | * flasky.css_t 3 | * ~~~~~~~~~~~~ 4 | * 5 | * Sphinx stylesheet -- flasky theme based on nature theme. 6 | * 7 | * :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS. 8 | * :license: BSD, see LICENSE for details. 9 | * 10 | */ 11 | 12 | @import url("basic.css"); 13 | 14 | /* -- page layout ----------------------------------------------------------- */ 15 | 16 | body { 17 | font-family: 'Georgia', serif; 18 | font-size: 17px; 19 | color: #000; 20 | background: white; 21 | margin: 0; 22 | padding: 0; 23 | } 24 | 25 | div.documentwrapper { 26 | float: left; 27 | width: 100%; 28 | } 29 | 30 | div.bodywrapper { 31 | margin: 40px auto 0 auto; 32 | width: 700px; 33 | } 34 | 35 | hr { 36 | border: 1px solid #B1B4B6; 37 | } 38 | 39 | div.body { 40 | background-color: #ffffff; 41 | color: #3E4349; 42 | padding: 0 30px 30px 30px; 43 | } 44 | 45 | img.floatingflask { 46 | padding: 0 0 10px 10px; 47 | float: right; 48 | } 49 | 50 | div.footer { 51 | text-align: right; 52 | color: #888; 53 | padding: 10px; 54 | font-size: 14px; 55 | width: 650px; 56 | margin: 0 auto 40px auto; 57 | } 58 | 59 | div.footer a { 60 | color: #888; 61 | text-decoration: underline; 62 | } 63 | 64 | div.related { 65 | line-height: 32px; 66 | color: #888; 67 | } 68 | 69 | div.related ul { 70 | padding: 0 0 0 10px; 71 | } 72 | 73 | div.related a { 74 | color: #444; 75 | } 76 | 77 | /* -- body styles ----------------------------------------------------------- */ 78 | 79 | a { 80 | color: #004B6B; 81 | text-decoration: underline; 82 | } 83 | 84 | a:hover { 85 | color: #6D4100; 86 | text-decoration: underline; 87 | } 88 | 89 | div.body { 90 | padding-bottom: 40px; /* saved for footer */ 91 | } 92 | 93 | div.body h1, 94 | div.body h2, 95 | div.body h3, 96 | div.body h4, 97 | div.body h5, 98 | div.body h6 { 99 | font-family: 'Garamond', 'Georgia', serif; 100 | font-weight: normal; 101 | margin: 30px 0px 10px 0px; 102 | padding: 0; 103 | } 104 | 105 | {% if theme_index_logo %} 106 | div.indexwrapper h1 { 107 | text-indent: -999999px; 108 | background: url({{ theme_index_logo }}) no-repeat center center; 109 | height: {{ theme_index_logo_height }}; 110 | } 111 | {% endif %} 112 | 113 | div.body h2 { font-size: 180%; } 114 | div.body h3 { font-size: 150%; } 115 | div.body h4 { font-size: 130%; } 116 | div.body h5 { font-size: 100%; } 117 | div.body h6 { font-size: 100%; } 118 | 119 | a.headerlink { 120 | color: white; 121 | padding: 0 4px; 122 | text-decoration: none; 123 | } 124 | 125 | a.headerlink:hover { 126 | color: #444; 127 | background: #eaeaea; 128 | } 129 | 130 | div.body p, div.body dd, div.body li { 131 | line-height: 1.4em; 132 | } 133 | 134 | div.admonition { 135 | background: #fafafa; 136 | margin: 20px -30px; 137 | padding: 10px 30px; 138 | border-top: 1px solid #ccc; 139 | border-bottom: 1px solid #ccc; 140 | } 141 | 142 | div.admonition p.admonition-title { 143 | font-family: 'Garamond', 'Georgia', serif; 144 | font-weight: normal; 145 | font-size: 24px; 146 | margin: 0 0 10px 0; 147 | padding: 0; 148 | line-height: 1; 149 | } 150 | 151 | div.admonition p.last { 152 | margin-bottom: 0; 153 | } 154 | 155 | div.highlight{ 156 | background-color: white; 157 | } 158 | 159 | dt:target, .highlight { 160 | background: #FAF3E8; 161 | } 162 | 163 | div.note { 164 | background-color: #eee; 165 | border: 1px solid #ccc; 166 | } 167 | 168 | div.seealso { 169 | background-color: #ffc; 170 | border: 1px solid #ff6; 171 | } 172 | 173 | div.topic { 174 | background-color: #eee; 175 | } 176 | 177 | div.warning { 178 | background-color: #ffe4e4; 179 | border: 1px solid #f66; 180 | } 181 | 182 | p.admonition-title { 183 | display: inline; 184 | } 185 | 186 | p.admonition-title:after { 187 | content: ":"; 188 | } 189 | 190 | pre, tt { 191 | font-family: 'Consolas', 'Menlo', 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace; 192 | font-size: 0.85em; 193 | } 194 | 195 | img.screenshot { 196 | } 197 | 198 | tt.descname, tt.descclassname { 199 | font-size: 0.95em; 200 | } 201 | 202 | tt.descname { 203 | padding-right: 0.08em; 204 | } 205 | 206 | img.screenshot { 207 | -moz-box-shadow: 2px 2px 4px #eee; 208 | -webkit-box-shadow: 2px 2px 4px #eee; 209 | box-shadow: 2px 2px 4px #eee; 210 | } 211 | 212 | table.docutils { 213 | border: 1px solid #888; 214 | -moz-box-shadow: 2px 2px 4px #eee; 215 | -webkit-box-shadow: 2px 2px 4px #eee; 216 | box-shadow: 2px 2px 4px #eee; 217 | } 218 | 219 | table.docutils td, table.docutils th { 220 | border: 1px solid #888; 221 | padding: 0.25em 0.7em; 222 | } 223 | 224 | table.field-list, table.footnote { 225 | border: none; 226 | -moz-box-shadow: none; 227 | -webkit-box-shadow: none; 228 | box-shadow: none; 229 | } 230 | 231 | table.footnote { 232 | margin: 15px 0; 233 | width: 100%; 234 | border: 1px solid #eee; 235 | } 236 | 237 | table.field-list th { 238 | padding: 0 0.8em 0 0; 239 | } 240 | 241 | table.field-list td { 242 | padding: 0; 243 | } 244 | 245 | table.footnote td { 246 | padding: 0.5em; 247 | } 248 | 249 | dl { 250 | margin: 0; 251 | padding: 0; 252 | } 253 | 254 | dl dd { 255 | margin-left: 30px; 256 | } 257 | 258 | pre { 259 | padding: 0; 260 | margin: 15px -30px; 261 | padding: 8px; 262 | line-height: 1.3em; 263 | padding: 7px 30px; 264 | background: #eee; 265 | border-radius: 2px; 266 | -moz-border-radius: 2px; 267 | -webkit-border-radius: 2px; 268 | } 269 | 270 | dl pre { 271 | margin-left: -60px; 272 | padding-left: 60px; 273 | } 274 | 275 | tt { 276 | background-color: #ecf0f3; 277 | color: #222; 278 | /* padding: 1px 2px; */ 279 | } 280 | 281 | tt.xref, a tt { 282 | background-color: #FBFBFB; 283 | } 284 | 285 | a:hover tt { 286 | background: #EEE; 287 | } 288 | -------------------------------------------------------------------------------- /docs/_themes/flask_small/theme.conf: -------------------------------------------------------------------------------- 1 | [theme] 2 | inherit = basic 3 | stylesheet = flasky.css 4 | nosidebar = true 5 | pygments_style = flask_theme_support.FlaskyStyle 6 | 7 | [options] 8 | index_logo = '' 9 | index_logo_height = 120px 10 | github_fork = '' 11 | -------------------------------------------------------------------------------- /docs/_themes/flask_theme_support.py: -------------------------------------------------------------------------------- 1 | # flasky extensions. flasky pygments style based on tango style 2 | from pygments.style import Style 3 | from pygments.token import Keyword, Name, Comment, String, Error, \ 4 | Number, Operator, Generic, Whitespace, Punctuation, Other, Literal 5 | 6 | 7 | class FlaskyStyle(Style): 8 | background_color = "#f8f8f8" 9 | default_style = "" 10 | 11 | styles = { 12 | # No corresponding class for the following: 13 | #Text: "", # class: '' 14 | Whitespace: "underline #f8f8f8", # class: 'w' 15 | Error: "#a40000 border:#ef2929", # class: 'err' 16 | Other: "#000000", # class 'x' 17 | 18 | Comment: "italic #8f5902", # class: 'c' 19 | Comment.Preproc: "noitalic", # class: 'cp' 20 | 21 | Keyword: "bold #004461", # class: 'k' 22 | Keyword.Constant: "bold #004461", # class: 'kc' 23 | Keyword.Declaration: "bold #004461", # class: 'kd' 24 | Keyword.Namespace: "bold #004461", # class: 'kn' 25 | Keyword.Pseudo: "bold #004461", # class: 'kp' 26 | Keyword.Reserved: "bold #004461", # class: 'kr' 27 | Keyword.Type: "bold #004461", # class: 'kt' 28 | 29 | Operator: "#582800", # class: 'o' 30 | Operator.Word: "bold #004461", # class: 'ow' - like keywords 31 | 32 | Punctuation: "bold #000000", # class: 'p' 33 | 34 | # because special names such as Name.Class, Name.Function, etc. 35 | # are not recognized as such later in the parsing, we choose them 36 | # to look the same as ordinary variables. 37 | Name: "#000000", # class: 'n' 38 | Name.Attribute: "#c4a000", # class: 'na' - to be revised 39 | Name.Builtin: "#004461", # class: 'nb' 40 | Name.Builtin.Pseudo: "#3465a4", # class: 'bp' 41 | Name.Class: "#000000", # class: 'nc' - to be revised 42 | Name.Constant: "#000000", # class: 'no' - to be revised 43 | Name.Decorator: "#888", # class: 'nd' - to be revised 44 | Name.Entity: "#ce5c00", # class: 'ni' 45 | Name.Exception: "bold #cc0000", # class: 'ne' 46 | Name.Function: "#000000", # class: 'nf' 47 | Name.Property: "#000000", # class: 'py' 48 | Name.Label: "#f57900", # class: 'nl' 49 | Name.Namespace: "#000000", # class: 'nn' - to be revised 50 | Name.Other: "#000000", # class: 'nx' 51 | Name.Tag: "bold #004461", # class: 'nt' - like a keyword 52 | Name.Variable: "#000000", # class: 'nv' - to be revised 53 | Name.Variable.Class: "#000000", # class: 'vc' - to be revised 54 | Name.Variable.Global: "#000000", # class: 'vg' - to be revised 55 | Name.Variable.Instance: "#000000", # class: 'vi' - to be revised 56 | 57 | Number: "#990000", # class: 'm' 58 | 59 | Literal: "#000000", # class: 'l' 60 | Literal.Date: "#000000", # class: 'ld' 61 | 62 | String: "#4e9a06", # class: 's' 63 | String.Backtick: "#4e9a06", # class: 'sb' 64 | String.Char: "#4e9a06", # class: 'sc' 65 | String.Doc: "italic #8f5902", # class: 'sd' - like a comment 66 | String.Double: "#4e9a06", # class: 's2' 67 | String.Escape: "#4e9a06", # class: 'se' 68 | String.Heredoc: "#4e9a06", # class: 'sh' 69 | String.Interpol: "#4e9a06", # class: 'si' 70 | String.Other: "#4e9a06", # class: 'sx' 71 | String.Regex: "#4e9a06", # class: 'sr' 72 | String.Single: "#4e9a06", # class: 's1' 73 | String.Symbol: "#4e9a06", # class: 'ss' 74 | 75 | Generic: "#000000", # class: 'g' 76 | Generic.Deleted: "#a40000", # class: 'gd' 77 | Generic.Emph: "italic #000000", # class: 'ge' 78 | Generic.Error: "#ef2929", # class: 'gr' 79 | Generic.Heading: "bold #000080", # class: 'gh' 80 | Generic.Inserted: "#00A000", # class: 'gi' 81 | Generic.Output: "#888", # class: 'go' 82 | Generic.Prompt: "#745334", # class: 'gp' 83 | Generic.Strong: "bold #000000", # class: 'gs' 84 | Generic.Subheading: "bold #800080", # class: 'gu' 85 | Generic.Traceback: "bold #a40000", # class: 'gt' 86 | } 87 | -------------------------------------------------------------------------------- /docs/conf.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # Flask-WebTest documentation build configuration file, created by 4 | # sphinx-quickstart on Thu Jul 18 00:44:29 2013. 5 | # 6 | # This file is execfile()d with the current directory set to its containing dir. 7 | # 8 | # Note that not all possible configuration values are present in this 9 | # autogenerated file. 10 | # 11 | # All configuration values have a default; values that are commented out 12 | # serve to show the default. 13 | 14 | import sys, os 15 | 16 | # If extensions (or modules to document with autodoc) are in another directory, 17 | # add these directories to sys.path here. If the directory is relative to the 18 | # documentation root, use os.path.abspath to make it absolute, like shown here. 19 | sys.path.insert(0, os.path.abspath('..')) 20 | 21 | # -- General configuration ----------------------------------------------------- 22 | 23 | # If your documentation needs a minimal Sphinx version, state it here. 24 | #needs_sphinx = '1.0' 25 | 26 | # Add any Sphinx extension module names here, as strings. They can be extensions 27 | # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. 28 | extensions = ['sphinx.ext.autodoc', 'sphinx.ext.intersphinx', 'sphinx.ext.viewcode'] 29 | 30 | # Add any paths that contain templates here, relative to this directory. 31 | templates_path = ['_templates'] 32 | 33 | # The suffix of source filenames. 34 | source_suffix = '.rst' 35 | 36 | # The encoding of source files. 37 | #source_encoding = 'utf-8-sig' 38 | 39 | # The master toctree document. 40 | master_doc = 'index' 41 | 42 | # General information about the project. 43 | project = u'Flask-WebTest' 44 | copyright = u'2013, Anton Romanovich' 45 | 46 | # The version info for the project you're documenting, acts as replacement for 47 | # |version| and |release|, also used in various other places throughout the 48 | # built documents. 49 | # 50 | # The short X.Y version. 51 | version = '0.0.3' 52 | # The full version, including alpha/beta/rc tags. 53 | release = '0.0.3' 54 | 55 | # The language for content autogenerated by Sphinx. Refer to documentation 56 | # for a list of supported languages. 57 | #language = None 58 | 59 | # There are two options for replacing |today|: either, you set today to some 60 | # non-false value, then it is used: 61 | #today = '' 62 | # Else, today_fmt is used as the format for a strftime call. 63 | #today_fmt = '%B %d, %Y' 64 | 65 | # List of patterns, relative to source directory, that match files and 66 | # directories to ignore when looking for source files. 67 | exclude_patterns = ['_build'] 68 | 69 | # The reST default role (used for this markup: `text`) to use for all documents. 70 | #default_role = None 71 | 72 | # If true, '()' will be appended to :func: etc. cross-reference text. 73 | #add_function_parentheses = True 74 | 75 | # If true, the current module name will be prepended to all description 76 | # unit titles (such as .. function::). 77 | #add_module_names = True 78 | 79 | # If true, sectionauthor and moduleauthor directives will be shown in the 80 | # output. They are ignored by default. 81 | #show_authors = False 82 | 83 | # The name of the Pygments (syntax highlighting) style to use. 84 | pygments_style = 'sphinx' 85 | 86 | # A list of ignored prefixes for module index sorting. 87 | #modindex_common_prefix = [] 88 | 89 | # If true, keep warnings as "system message" paragraphs in the built documents. 90 | #keep_warnings = False 91 | 92 | 93 | # -- Options for HTML output --------------------------------------------------- 94 | 95 | # The theme to use for HTML and HTML Help pages. See the documentation for 96 | # a list of builtin themes. 97 | sys.path.append(os.path.abspath('_themes')) 98 | html_theme_path = ['_themes'] 99 | html_theme = 'flask_small' 100 | html_theme_options = { 101 | 'github_fork': 'level12/flask-webtest', 102 | 'index_logo': False, 103 | } 104 | 105 | # Theme options are theme-specific and customize the look and feel of a theme 106 | # further. For a list of options available for each theme, see the 107 | # documentation. 108 | #html_theme_options = {} 109 | 110 | # Add any paths that contain custom themes here, relative to this directory. 111 | #html_theme_path = [] 112 | 113 | # The name for this set of Sphinx documents. If None, it defaults to 114 | # " v documentation". 115 | #html_title = None 116 | 117 | # A shorter title for the navigation bar. Default is the same as html_title. 118 | #html_short_title = None 119 | 120 | # The name of an image file (relative to this directory) to place at the top 121 | # of the sidebar. 122 | #html_logo = None 123 | 124 | # The name of an image file (within the static path) to use as favicon of the 125 | # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 126 | # pixels large. 127 | #html_favicon = None 128 | 129 | # Add any paths that contain custom static files (such as style sheets) here, 130 | # relative to this directory. They are copied after the builtin static files, 131 | # so a file named "default.css" will overwrite the builtin "default.css". 132 | html_static_path = ['_static'] 133 | 134 | # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, 135 | # using the given strftime format. 136 | #html_last_updated_fmt = '%b %d, %Y' 137 | 138 | # If true, SmartyPants will be used to convert quotes and dashes to 139 | # typographically correct entities. 140 | #html_use_smartypants = True 141 | 142 | # Custom sidebar templates, maps document names to template names. 143 | #html_sidebars = {} 144 | 145 | # Additional templates that should be rendered to pages, maps page names to 146 | # template names. 147 | #html_additional_pages = {} 148 | 149 | # If false, no module index is generated. 150 | #html_domain_indices = True 151 | 152 | # If false, no index is generated. 153 | #html_use_index = True 154 | 155 | # If true, the index is split into individual pages for each letter. 156 | #html_split_index = False 157 | 158 | # If true, links to the reST sources are added to the pages. 159 | #html_show_sourcelink = True 160 | 161 | # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. 162 | #html_show_sphinx = True 163 | 164 | # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. 165 | #html_show_copyright = True 166 | 167 | # If true, an OpenSearch description file will be output, and all pages will 168 | # contain a tag referring to it. The value of this option must be the 169 | # base URL from which the finished HTML is served. 170 | #html_use_opensearch = '' 171 | 172 | # This is the file name suffix for HTML files (e.g. ".xhtml"). 173 | #html_file_suffix = None 174 | 175 | # Output file base name for HTML help builder. 176 | htmlhelp_basename = 'Flask-WebTestdoc' 177 | 178 | 179 | # -- Options for LaTeX output -------------------------------------------------- 180 | 181 | latex_elements = { 182 | # The paper size ('letterpaper' or 'a4paper'). 183 | #'papersize': 'letterpaper', 184 | 185 | # The font size ('10pt', '11pt' or '12pt'). 186 | #'pointsize': '10pt', 187 | 188 | # Additional stuff for the LaTeX preamble. 189 | #'preamble': '', 190 | } 191 | 192 | # Grouping the document tree into LaTeX files. List of tuples 193 | # (source start file, target name, title, author, documentclass [howto/manual]). 194 | latex_documents = [ 195 | ('index', 'Flask-WebTest.tex', u'Flask-WebTest Documentation', 196 | u'Anton Romanovich', 'manual'), 197 | ] 198 | 199 | # The name of an image file (relative to this directory) to place at the top of 200 | # the title page. 201 | #latex_logo = None 202 | 203 | # For "manual" documents, if this is true, then toplevel headings are parts, 204 | # not chapters. 205 | #latex_use_parts = False 206 | 207 | # If true, show page references after internal links. 208 | #latex_show_pagerefs = False 209 | 210 | # If true, show URL addresses after external links. 211 | #latex_show_urls = False 212 | 213 | # Documents to append as an appendix to all manuals. 214 | #latex_appendices = [] 215 | 216 | # If false, no module index is generated. 217 | #latex_domain_indices = True 218 | 219 | 220 | # -- Options for manual page output -------------------------------------------- 221 | 222 | # One entry per manual page. List of tuples 223 | # (source start file, name, description, authors, manual section). 224 | man_pages = [ 225 | ('index', 'flask-webtest', u'Flask-WebTest Documentation', 226 | [u'Anton Romanovich'], 1) 227 | ] 228 | 229 | # If true, show URL addresses after external links. 230 | #man_show_urls = False 231 | 232 | 233 | # -- Options for Texinfo output ------------------------------------------------ 234 | 235 | # Grouping the document tree into Texinfo files. List of tuples 236 | # (source start file, target name, title, author, 237 | # dir menu entry, description, category) 238 | texinfo_documents = [ 239 | ('index', 'Flask-WebTest', u'Flask-WebTest Documentation', 240 | u'Anton Romanovich', 'Flask-WebTest', 'One line description of project.', 241 | 'Miscellaneous'), 242 | ] 243 | 244 | # Documents to append as an appendix to all manuals. 245 | #texinfo_appendices = [] 246 | 247 | # If false, no module index is generated. 248 | #texinfo_domain_indices = True 249 | 250 | # How to display URL addresses: 'footnote', 'no', or 'inline'. 251 | #texinfo_show_urls = 'footnote' 252 | 253 | # If true, do not generate a @detailmenu in the "Top" node's menu. 254 | #texinfo_no_detailmenu = False 255 | -------------------------------------------------------------------------------- /docs/index.rst: -------------------------------------------------------------------------------- 1 | ============= 2 | Flask-WebTest 3 | ============= 4 | .. currentmodule:: flask_webtest 5 | 6 | .. contents:: 7 | :local: 8 | 9 | Overview 10 | ======== 11 | 12 | Flask-WebTest provides a set of utilities to ease testing `Flask`_ 13 | applications with `WebTest`_. 14 | 15 | * :class:`.TestApp` extends :class:`webtest.TestApp`'s response by adding fields that 16 | provide access to the template contexts, session data and flashed messages. 17 | * :class:`SessionScope` and :func:`get_scopefunc` allow to manage SQLAlchemy session 18 | scoping ― it's very useful for testing. 19 | 20 | Installation 21 | ============ 22 | 23 | ``pip install flask-webtest`` 24 | 25 | Example of usage 26 | ================ 27 | 28 | :: 29 | 30 | from unittest import TestCase 31 | from flask_webtest import TestApp 32 | from main import app, db 33 | 34 | class ExampleTest(TestCase): 35 | def setUp(self): 36 | self.app = app 37 | self.w = TestApp(self.app, db=db, use_session_scopes=True) 38 | 39 | def test(self): 40 | r = self.w.get('/') 41 | # Assert there was no messages flushed: 42 | self.assertFalse(r.flashes) 43 | # Access and check any variable from template context... 44 | self.assertEqual(r.context['text'], 'Hello!') 45 | self.assertEqual(r.template, 'template.html') 46 | # ...and from session 47 | self.assertNotIn('user_id', r.session) 48 | 49 | 50 | Configuration 51 | ============= 52 | 53 | Flask-WebTest uses an app config variable, `FLASK_WEBTEST_PUSH_APP_CONTEXT`, to 54 | determine whether to push a fresh app context on each test request. By default, 55 | to preserve backwards compatibility, this config flag is disabled. However, in 56 | general production use, flask pushes both an app context and a request context 57 | for each request cycle. 58 | 59 | Depending on app architecture and the way in which the app is initialized for 60 | running a test suite, you may need to enable these context pushes. 61 | 62 | 63 | API Documentation 64 | ================= 65 | 66 | This documentation is automatically generated from Flask-WebTest's source code. 67 | 68 | .. autoclass:: TestApp 69 | 70 | .. automethod:: session_transaction 71 | 72 | API related to Flask-SQLAlchemy 73 | ------------------------------- 74 | .. autofunction:: get_scopefunc 75 | 76 | .. autoclass:: SessionScope 77 | 78 | .. automethod:: push 79 | 80 | .. automethod:: pop 81 | 82 | .. _WebTest: https://docs.pylonsproject.org/projects/webtest 83 | .. _Flask: https://flask.palletsprojects.com 84 | 85 | Using Flask-WebTest with Flask-SQLAlchemy 86 | ========================================= 87 | 88 | Let's suppose there is a simple application consisting of two views (and `User` model which 89 | is omitted for brevity): 90 | 91 | :: 92 | 93 | app = Flask(__name__) 94 | db = SQLAlchemy(app) 95 | 96 | @app.route('/user//') 97 | def user(id): 98 | return User.query.get_or_404(id).greet() 99 | 100 | @app.route('/user//preview/', methods=['POST']) 101 | def preview(id): 102 | user = User.query.get_or_404(id) 103 | user.greeting = request.form['name'] 104 | # Expunge `user` from the session so that we can 105 | # call `db.session.commit` later and do not change 106 | # user data in table 107 | db.session.expunge(user) 108 | return user.greet() 109 | 110 | How can one test it using WebTest? 111 | An approach that comes to mind first may look as follows: 112 | 113 | :: 114 | 115 | class Test(TestCase): 116 | def setUp(self): 117 | self.w = TestApp(self.app) 118 | self.app_context = app.app_context() 119 | self.app_context.push() 120 | db.create_all() 121 | 122 | def tearDown(self): 123 | db.drop_all() 124 | self.app_context.pop() 125 | 126 | def test(self): 127 | user = User(name='Anton') 128 | db.session.add(user) 129 | db.session.commit() 130 | r = self.w.get('/user/%i/' % user.id) 131 | self.assertEqual(r.body, 'Hello, Anton!') 132 | 133 | Everything looks good, but sometimes strange (at first sight) things happen: 134 | 135 | * Uncommitted changes happen to be used to build the response: 136 | 137 | :: 138 | 139 | user.name = 'Petr' 140 | # Note: we did not commit the change to `user`! 141 | r = self.w.get('/user/%i/' % user.id) 142 | 143 | self.assertEqual(r.body, 'Hello, Anton!') 144 | # AssertionError: 'Hello, Petr!' != 'Hello, Anton!' 145 | 146 | * Model disappears from the session after request: 147 | 148 | :: 149 | 150 | r = self.w.post('/user/%i/preview/' % user.id, { 151 | 'greeting': 'Hi, %s.', 152 | }) 153 | self.assertEqual(r.body, 'Hi, Anton.') 154 | 155 | db.session.refresh(user) 156 | # InvalidRequestError: Instance '' is 157 | # not persistent within this session 158 | 159 | * And so on. 160 | 161 | These examples may seem a bit contrived, but they will likely arise in your project as it 162 | uses the ORM more extensively. 163 | 164 | Why do they appear? Because we use the same SQLAlchemy session in our test and application code. 165 | 166 | Any time you call ``db.session`` it passes the call to the session 167 | bound to the current scope (which is defined by ``scopefunc``). 168 | By default, Flask-SQLAlchemy defines ``scopefunc`` to return current thread's identity. 169 | 170 | In production normally: 171 | 172 | 1. Only one request being handled at a time within each thread; 173 | 2. The session being opened when ``db.session`` is called the first time; 174 | 3. Flask-SQLAlchemy closes the session after request (exactly on application teardown). 175 | 176 | Providing that, the application uses a separate session during each request. 177 | The session is opened at the start and closed at the end of the request. 178 | 179 | In the current tests' implementation: 180 | 181 | 1. Every request being handled in the same thread, hence using the same SQLAlchemy session; 182 | 2. The session being opened the first time ``db.session`` is called, and it happens 183 | when the test loads fixtures; 184 | 3. Flask-SQLAlchemy closes the session on application teardown. It happens 185 | only in ``tearDown`` method ― when the last context leaves the 186 | application contexts' stack. 187 | 188 | So, the situation is very different: the same SQLAlchemy session is being used 189 | to handle all the requests made during test. This is a major difference from 190 | how things work in production and it would be great to eliminate it. 191 | 192 | Flask-WebTest provides means to easily manage SQLAlchemy scopes: 193 | ``SQLAlchemyScope`` that you can enter and exit and custom ``scopefunc`` 194 | that has to be used during testing. 195 | 196 | How to make use of them: 197 | 198 | 1. Replace default ``scopefunc`` with ``SQLAlchemyScope``-aware ``scopefunc`` from Flask-WebTest: 199 | 200 | :: 201 | 202 | from flask_webtest import get_scopefunc 203 | 204 | def make_db(app): 205 | session_options = {} 206 | if app.testing: 207 | session_options['scopefunc'] = get_scopefunc() 208 | return SQLAlchemy(app, session_options=session_options) 209 | 210 | app = Flask(__name__) 211 | ... 212 | db = make_db(app) 213 | 214 | 2. Whenever you want a piece of code to use a new SQLAlchemy session, execute it within a scope: 215 | 216 | :: 217 | 218 | user = User(name='Anton') 219 | db.session.add(user) 220 | db.session.commit() 221 | print(user in db.session) # True 222 | 223 | with SessionScope(db): 224 | # Brand new session! 225 | print(user in db.session) # False 226 | 227 | or 228 | 229 | :: 230 | 231 | scope = SessionScope(db) 232 | scope.push() 233 | try: 234 | ... 235 | finally: 236 | scope.pop() 237 | 238 | It makes sense to use a fresh SQLAlchemyScope for every request. 239 | :class:`.TestApp` will do it for you if you pass `db` to it's 240 | constructor and specify `use_session_scopes`. 241 | 242 | If your project uses Celery (or other task queue) and 243 | performs tasks synchronously during tests ― it's a great idea 244 | to run them within separate scopes too. 245 | 246 | .. note:: 247 | 248 | Be aware that model is bound to the session and 249 | in general you can't use object whose session was removed: 250 | 251 | :: 252 | 253 | with SessionScope(db): 254 | john = User(name='John') 255 | db.session.add(john) 256 | # Note: commit expires all models (SQLAlchemy has 257 | # expire_on_commit=True by default)... 258 | db.session.commit() 259 | 260 | print(john in db.session) # False 261 | 262 | # Any call to an expired model requires database hit, so 263 | # `print(john.name)` would cause the following error: 264 | # 265 | # DetachedInstanceError: Instance 266 | # is not bound to a Session; attribute refresh 267 | # operation cannot proceed 268 | # 269 | # It would happen because `john`'s session no longer exists. 270 | # To continue working with detached object, we need to 271 | # reconcile it with the current session: 272 | john = db.session.merge(john) 273 | 274 | print(john in db.session) # True 275 | print(john.name) # John 276 | 277 | Dealing with transaction isolation levels 278 | ----------------------------------------- 279 | 280 | Using a high isolation level may cause some inconveniences during testing. 281 | Consider this example: 282 | 283 | :: 284 | 285 | # Current session represents transaction X 286 | user = User.query.filter(User.name == 'Anton').first() 287 | 288 | with SessionScope(db): 289 | # Now current session represents transaction Y 290 | user_copy = User.query.filter(User.name == 'Anton').first() 291 | user_copy.name = 'Petr' 292 | db.session.add(user_copy) 293 | db.session.commit() 294 | 295 | # Again, current session represents transaction X 296 | db.session.refresh(user) 297 | self.assertEqual(user.name, 'Petr') 298 | 299 | The last assertion would fail if ``REPEATABLE READ`` level is being used, 300 | because transaction ``X`` is isolated from any changes made by transaction ``Y``. 301 | 302 | To make changes from ``Y`` visible you need to either commit or rollback ``X``: 303 | 304 | :: 305 | 306 | ... 307 | 308 | # Again, current session represents transaction X 309 | db.session.rollback() 310 | self.assertEqual(layout.name, 'Petr') # Yay! 311 | 312 | 313 | If it's acceptable, you can just lower the isolation level to ``READ COMMITTED`` 314 | and avoid thinking about this issue: 315 | 316 | :: 317 | 318 | from flask_sqlalchemy import SQLAlchemy as BaseSQLAlchemy 319 | 320 | class SQLAlchemy(BaseSQLAlchemy): 321 | def apply_driver_hacks(self, app, info, options): 322 | if 'isolation_level' not in options: 323 | options['isolation_level'] = 'READ COMMITTED' 324 | return super(SQLAlchemy, self).apply_driver_hacks( 325 | app, info, options) 326 | -------------------------------------------------------------------------------- /docs/requirements.txt: -------------------------------------------------------------------------------- 1 | babel==2.11.0 2 | sphinx 3 | -e .[test] 4 | -------------------------------------------------------------------------------- /flask_webtest.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | import importlib.metadata 3 | from http import cookiejar 4 | from copy import copy 5 | from functools import partial 6 | from contextlib import contextmanager, nullcontext 7 | 8 | from werkzeug.local import LocalStack 9 | from flask import g, session, get_flashed_messages 10 | from flask.signals import template_rendered, request_started, request_finished 11 | from webtest import (TestApp as BaseTestApp, 12 | TestRequest as BaseTestRequest, 13 | TestResponse as BaseTestResponse) 14 | 15 | flask_version = importlib.metadata.version('flask') 16 | 17 | try: 18 | import flask_sqlalchemy 19 | except ImportError: 20 | flask_sqlalchemy = None 21 | 22 | try: 23 | # Available starting with Flask 0.10 24 | from flask.signals import message_flashed 25 | except ImportError: 26 | message_flashed = None 27 | 28 | 29 | _session_scope_stack = LocalStack() 30 | 31 | 32 | class SessionScope(object): 33 | """Session scope, being pushed, changes the value of 34 | :func:`.scopefunc` and, as a result, calls to `db.session` 35 | are proxied to the new underlying session. 36 | When popped, removes the current session and swap the value of 37 | :func:`.scopefunc` to the one that was before. 38 | 39 | :param db: :class:`flask_sqlalchemy.SQLAlchemy` instance 40 | """ 41 | 42 | def __init__(self, db): 43 | self.db = db 44 | 45 | def push(self): 46 | """Pushes the session scope.""" 47 | _session_scope_stack.push(self) 48 | 49 | def pop(self): 50 | """Removes the current session and pops the session scope.""" 51 | self.db.session.remove() 52 | rv = _session_scope_stack.pop() 53 | assert rv is self, 'Popped wrong session scope. (%r instead of %r)' \ 54 | % (rv, self) 55 | 56 | def __enter__(self): 57 | self.push() 58 | return self 59 | 60 | def __exit__(self, exc_type, exc_value, tb): 61 | self.pop() 62 | 63 | 64 | def get_scopefunc(original_scopefunc=None): 65 | """Returns :func:`.SessionScope`-aware `scopefunc` that has to be used 66 | during testing. 67 | """ 68 | 69 | if original_scopefunc is None: 70 | assert flask_sqlalchemy, 'Is Flask-SQLAlchemy installed?' 71 | 72 | try: 73 | # for flask_sqlalchemy older than 2.2 where the connection_stack 74 | # was either the app stack or the request stack 75 | original_scopefunc = flask_sqlalchemy.connection_stack.__ident_func__ 76 | except AttributeError: 77 | try: 78 | # when flask_sqlalchemy 2.2 or newer, which supports only flask 0.10 79 | # or newer, we use app stack 80 | from flask import _app_ctx_stack 81 | original_scopefunc = _app_ctx_stack.__ident_func__ 82 | except (AttributeError, ImportError): 83 | # flask 3.0.0 or newer does not export _app_ctx_stack 84 | # newer flask does not expose an __ident_func__, use greenlet directly 85 | import greenlet 86 | original_scopefunc = greenlet.getcurrent 87 | 88 | def scopefunc(): 89 | rv = original_scopefunc() 90 | sqlalchemy_scope = _session_scope_stack.top 91 | if sqlalchemy_scope: 92 | rv = (rv, id(sqlalchemy_scope)) 93 | return rv 94 | 95 | return scopefunc 96 | 97 | 98 | def store_rendered_template(app, template, context, **extra): 99 | g._flask_webtest.setdefault('contexts', []).append((template.name, context)) 100 | 101 | 102 | def store_flashed_message(app, message, category, **extra): 103 | g._flask_webtest.setdefault('flashes', []).append((category, message)) 104 | 105 | 106 | def set_up(app, *args, **extra): 107 | g._flask_webtest = {} 108 | if not message_flashed: 109 | def _get_flashed_messages(*args, **kwargs): 110 | # `get_flashed_messages` removes messages from session, 111 | # so we store them in `g._flask_webtest` 112 | flashes_to_be_consumed = copy(session.get('_flashes', [])) 113 | g._flask_webtest.setdefault('flashes', []).extend(flashes_to_be_consumed) 114 | return get_flashed_messages(*args, **kwargs) 115 | app.jinja_env.globals['get_flashed_messages'] = _get_flashed_messages 116 | 117 | 118 | def tear_down(store, app, response, *args, **extra): 119 | g._flask_webtest['session'] = dict(session) 120 | store.update(g._flask_webtest) 121 | del g._flask_webtest 122 | if not message_flashed: 123 | app.jinja_env.globals['get_flashed_messages'] = get_flashed_messages 124 | 125 | 126 | class TestResponse(BaseTestResponse): 127 | contexts = {} 128 | 129 | def _make_contexts_assertions(self): 130 | assert self.contexts, 'No templates used to render the response.' 131 | assert len(self.contexts) == 1, \ 132 | ('More than one template used to render the response. ' 133 | 'Use `contexts` attribute to access their names and contexts.') 134 | 135 | @property 136 | def context(self): 137 | self._make_contexts_assertions() 138 | return list(self.contexts.values())[0] 139 | 140 | @property 141 | def template(self): 142 | self._make_contexts_assertions() 143 | return list(self.contexts.keys())[0] 144 | 145 | 146 | class TestRequest(BaseTestRequest): 147 | ResponseClass = TestResponse 148 | 149 | 150 | class CookieJar(cookiejar.CookieJar): 151 | """CookieJar that always sets ASCII headers, even if cookies have 152 | unicode parts such as name, value or path. It is necessary to make 153 | :meth:`TestApp.session_transaction` work correctly. 154 | """ 155 | def _cookie_attrs(self, cookies): 156 | attrs = cookiejar.CookieJar._cookie_attrs(self, cookies) 157 | return map(str, attrs) 158 | 159 | 160 | class TestApp(BaseTestApp): 161 | """Extends :class:`webtest.TestApp` by adding few fields to responses: 162 | 163 | .. attribute:: templates 164 | 165 | Dictionary containing information about what templates were used to 166 | build the response and what their contexts were. 167 | The keys are template names and the values are template contexts. 168 | 169 | .. attribute:: flashes 170 | 171 | List of tuples (category, message) containing messages that were 172 | flashed during request. 173 | 174 | Note: Fully supported only starting with Flask 0.10. If you use 175 | previous version, `flashes` will contain only those messages that 176 | were consumed by :func:`flask.get_flashed_messages` template calls. 177 | 178 | .. attribute:: session 179 | 180 | Dictionary that contains session data. 181 | 182 | If exactly one template was used to render the response, it's name and context 183 | can be accessed using `response.template` and `response.context` properties. 184 | 185 | If `app` config sets SERVER_NAME and HTTP_HOST is not specified in 186 | `extra_environ`, :class:`TestApp` will also set HTTP_HOST to SERVER_NAME 187 | for all requests to the app. 188 | 189 | :param app: :class:`flask.Flask` instance 190 | :param db: :class:`flask_sqlalchemy.SQLAlchemy` instance 191 | :param use_session_scopes: if specified, application performs each request 192 | within it's own separate session scope 193 | """ 194 | RequestClass = TestRequest 195 | 196 | def __init__(self, app, db=None, use_session_scopes=False, cookiejar=None, 197 | extra_environ=None, *args, **kwargs): 198 | if use_session_scopes: 199 | assert db, ('`db` (instance of `flask_sqlalchemy.SQLAlchemy`) ' 200 | 'must be passed to use session scopes.') 201 | self.db = db 202 | self.use_session_scopes = use_session_scopes 203 | 204 | if extra_environ is None: 205 | extra_environ = {} 206 | if app.config['SERVER_NAME'] and 'HTTP_HOST' not in extra_environ: 207 | extra_environ['HTTP_HOST'] = app.config['SERVER_NAME'] 208 | 209 | super(TestApp, self).__init__(app, extra_environ=extra_environ, 210 | *args, **kwargs) 211 | # cookielib.CookieJar defines __len__ and empty CookieJar evaluates 212 | # to False in boolan context. That's why we explicitly compare 213 | # `cookiejar` with None: 214 | self.cookiejar = CookieJar() if cookiejar is None else cookiejar 215 | 216 | def do_request(self, *args, **kwargs): 217 | store = {} 218 | tear_down_ = partial(tear_down, store) 219 | 220 | request_started.connect(set_up) 221 | request_finished.connect(tear_down_) 222 | template_rendered.connect(store_rendered_template) 223 | if message_flashed: 224 | message_flashed.connect(store_flashed_message) 225 | 226 | if self.use_session_scopes: 227 | scope = SessionScope(self.db) 228 | scope.push() 229 | 230 | context = nullcontext 231 | if self.app.config.get('FLASK_WEBTEST_PUSH_APP_CONTEXT', False): 232 | context = self.app.app_context 233 | try: 234 | with context(): 235 | response = super(TestApp, self).do_request(*args, **kwargs) 236 | finally: 237 | if self.use_session_scopes: 238 | scope.pop() 239 | template_rendered.disconnect(store_rendered_template) 240 | request_finished.disconnect(tear_down_) 241 | request_started.disconnect(set_up) 242 | if message_flashed: 243 | message_flashed.disconnect(store_flashed_message) 244 | 245 | response.session = store.get('session', {}) 246 | response.flashes = store.get('flashes', []) 247 | response.contexts = dict(store.get('contexts', [])) 248 | return response 249 | 250 | def set_werkzeug_cookie(self, name, value, domain, path): 251 | """ 252 | As of Werkzeug 2.3.0, cookie implementation was refactored, and cookies 253 | no longer have the same footprint as http.cookiejar.Cookie. But, webtest 254 | expects the http-lib cookies to set up the test request. 255 | 256 | Do some basic translation here for any cookies set in a session transaction. 257 | """ 258 | # Match what webtest.set_cookie() does for the domain or we can end up with "duplicate" 259 | # cookies with different domains when using session_transaction() 260 | if '.' not in domain: 261 | domain = "%s.local" % domain 262 | 263 | if flask_version.startswith('2.2.') and not domain.startswith('.'): 264 | # Flask 2.3 dropped the leading dot for cookie domains, but we still need it for < 2.3 265 | domain = f'.{domain}' 266 | 267 | cookie = cookiejar.Cookie( 268 | version=0, 269 | name=name, 270 | value=value, 271 | port=None, 272 | port_specified=False, 273 | domain=domain, 274 | domain_specified=True, 275 | domain_initial_dot=False, 276 | path=path, 277 | path_specified=True, 278 | secure=False, 279 | expires=None, 280 | discard=False, 281 | comment=None, 282 | comment_url=None, 283 | rest=None 284 | ) 285 | self.cookiejar.set_cookie(cookie) 286 | 287 | @contextmanager 288 | def session_transaction(self): 289 | """When used in combination with a with statement this opens 290 | a session transaction. This can be used to modify the session 291 | that the test client uses. Once the with block is left the session 292 | is stored back. 293 | 294 | For example, if you use Flask-Login, you can log in a user using 295 | this method:: 296 | 297 | with client.session_transaction() as sess: 298 | sess['user_id'] = 1 299 | 300 | Internally it uses :meth:`flask.testing.FlaskClient.session_transaction`. 301 | """ 302 | with self.app.test_client() as client: 303 | translate_werkzeug_cookie = hasattr(client, 'get_cookie') 304 | 305 | for cookie in self.cookiejar: 306 | if translate_werkzeug_cookie: 307 | client.set_cookie( 308 | cookie.name, 309 | value=cookie.value, 310 | # http.cookiejar has code everywhere that normalizes "localhost" to 311 | # localhost.local everywhere. But, Flask/Werkzeug just use "localhost". 312 | # If this isn't changed, then FlaskClient looks for cookies that match 313 | # "localhost.local" and "localhost" doesn't match that. This results in 314 | # losing the existing session (if there is one). 315 | domain='localhost' if cookie.domain == 'localhost.local' else cookie.domain, 316 | path=cookie.path, 317 | ) 318 | else: 319 | client.cookie_jar.set_cookie(cookie) 320 | 321 | with client.session_transaction() as sess: 322 | yield sess 323 | 324 | if translate_werkzeug_cookie: 325 | for cookie in client._cookies.values(): 326 | self.set_werkzeug_cookie(cookie.key, cookie.value, cookie.domain, cookie.path) 327 | else: 328 | for cookie in client.cookie_jar: 329 | # Cookies from `client.cookie_jar` may contain unicode name 330 | # and value. It would make WebTest linter (:mod:`webtest.lint`) 331 | # throw assertion errors about unicode environmental 332 | # variable (HTTP_COOKIE), but we use custom CookieJar that is 333 | # aware of this oddity and always sets 8-bit headers. 334 | self.cookiejar.set_cookie(cookie) 335 | -------------------------------------------------------------------------------- /mise.toml: -------------------------------------------------------------------------------- 1 | [tools] 2 | python = ["3.12", "3.9", "3.10", "3.11"] 3 | 4 | [env] 5 | _.python.venv.path = "{{env.WORKON_HOME}}/flask-webtest" 6 | _.python.venv.create = true 7 | -------------------------------------------------------------------------------- /pyp.ini: -------------------------------------------------------------------------------- 1 | [pyp] 2 | source_dir = . 3 | -------------------------------------------------------------------------------- /requirements-dev.txt: -------------------------------------------------------------------------------- 1 | Flask-SQLAlchemy>=2.5.0 2 | Sphinx 3 | -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | [bdist_wheel] 2 | universal=1 3 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | """ 2 | Flask-WebTest 3 | ------------- 4 | 5 | Provides a set of utilities to ease testing Flask applications with WebTest. 6 | 7 | Links 8 | ````` 9 | 10 | * `documentation `_ 11 | * `development version 12 | `_ 13 | """ 14 | import os.path as osp 15 | from setuptools import setup 16 | 17 | cdir = osp.abspath(osp.dirname(__file__)) 18 | version_fpath = osp.join(cdir, 'version.py') 19 | version_globals = {} 20 | with open(version_fpath) as fo: 21 | exec(fo.read(), version_globals) 22 | 23 | setup( 24 | name='Flask-WebTest', 25 | version=version_globals['VERSION'], 26 | url='https://github.com/level12/flask-webtest', 27 | license='BSD', 28 | description = 'Utilities for testing Flask applications with WebTest.', 29 | long_description=__doc__, 30 | author='Anton Romanovich', 31 | author_email='anthony.romanovich@gmail.com', 32 | include_package_data=True, 33 | py_modules=['flask_webtest'], 34 | zip_safe=False, 35 | install_requires=[ 36 | 'Flask>=1.1.0', 37 | 'WebTest', 38 | 'blinker', 39 | ], 40 | extras_require={ 41 | 'tests': [ 42 | 'flask-sqlalchemy', 43 | 'greenlet', 44 | ], 45 | }, 46 | classifiers=[ 47 | 'Topic :: Software Development :: Testing', 48 | 'Environment :: Web Environment', 49 | 'Intended Audience :: Developers', 50 | 'Programming Language :: Python :: 3', 51 | ], 52 | ) 53 | -------------------------------------------------------------------------------- /stable-requirements.txt: -------------------------------------------------------------------------------- 1 | attrs==22.2.0 2 | beautifulsoup4==4.11.2 3 | blinker==1.5 4 | click==8.1.3 5 | exceptiongroup==1.1.0 6 | Flask==2.2.3 7 | Flask-SQLAlchemy==3.0.3 8 | greenlet==3.0.3 9 | importlib-metadata==6.0.0 10 | iniconfig==2.0.0 11 | itsdangerous==2.1.2 12 | Jinja2==3.1.2 13 | MarkupSafe==2.1.2 14 | packaging==23.0 15 | pluggy==1.0.0 16 | pytest==7.2.1 17 | soupsieve==2.4 18 | SQLAlchemy==2.0.4 19 | tomli==2.0.1 20 | typing_extensions==4.6.3 21 | waitress==2.1.2 22 | WebOb==1.8.7 23 | WebTest==3.0.0 24 | Werkzeug==2.2.3 25 | zipp==3.15.0 26 | -------------------------------------------------------------------------------- /test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | python -m unittest discover 3 | -------------------------------------------------------------------------------- /tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/level12/flask-webtest/1e8f907fc1794d301c7acfc1f78a22554dc5df08/tests/__init__.py -------------------------------------------------------------------------------- /tests/core.py: -------------------------------------------------------------------------------- 1 | from flask import Flask, request, flash, render_template, session 2 | 3 | 4 | app = Flask(__name__) 5 | app.testing = True 6 | app.config['SECRET_KEY'] = '123' 7 | app.config['DEBUG'] = '123' 8 | 9 | 10 | @app.route('/', methods=['GET', 'POST']) 11 | def home(): 12 | if request.method == 'POST': 13 | flash('You have pressed "Quit"...') 14 | render_template('extra-template.html', extra_text='Some text.') 15 | response = render_template('template.html', text='Goodbye!') 16 | flash('Flash message that will never be shown') 17 | return response 18 | else: 19 | return render_template('template.html', text='Hello!') 20 | 21 | 22 | @app.route('/whoami/') 23 | def whoami(): 24 | return session.get('username', 'nobody') 25 | 26 | 27 | @app.route('/sess/') 28 | def sess(action: str): 29 | assert action in ('save', 'get') 30 | if action == 'save': 31 | session['foo'] = 'bar' 32 | return 'ok' 33 | else: 34 | return session.get('picard', 'riker') + session.get('foo', 'baz') 35 | 36 | -------------------------------------------------------------------------------- /tests/core_sqlalchemy.py: -------------------------------------------------------------------------------- 1 | from flask import Flask, abort, request 2 | from flask_sqlalchemy import SQLAlchemy 3 | from flask_webtest import get_scopefunc 4 | 5 | 6 | def make_db(app): 7 | session_options = {} 8 | if app.testing: 9 | session_options['scopefunc'] = get_scopefunc() 10 | return SQLAlchemy(app, session_options=session_options) 11 | 12 | 13 | app = Flask(__name__) 14 | app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite://' 15 | app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False 16 | app.testing = True 17 | db = make_db(app) 18 | 19 | 20 | class User(db.Model): 21 | id = db.Column(db.Integer, primary_key=True) 22 | name = db.Column(db.String(80)) 23 | greeting = db.Column(db.String(80), default=u'Hello, %s!') 24 | 25 | def greet(self): 26 | return self.greeting % self.name 27 | 28 | 29 | @app.route('/user//') 30 | def user(id): 31 | user = db.session.get(User, id) 32 | if not user: 33 | return abort(404) 34 | return user.greet() 35 | 36 | 37 | @app.route('/user//preview/', methods=['POST']) 38 | def preview(id): 39 | user = db.session.get(User, id) 40 | if not user: 41 | return abort(404) 42 | user.greeting = request.form['greeting'] 43 | db.session.expunge(user) 44 | return user.greet() 45 | -------------------------------------------------------------------------------- /tests/templates/extra-template.html: -------------------------------------------------------------------------------- 1 | {{ extra_text }} 2 | -------------------------------------------------------------------------------- /tests/templates/template.html: -------------------------------------------------------------------------------- 1 | {% for message in get_flashed_messages() %} 2 |

{{ message }}

3 | {% endfor %} 4 | 5 |

{{ text }}

6 | 7 |
8 | 9 |
10 | -------------------------------------------------------------------------------- /tests/test.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | 3 | import sqlalchemy 4 | from flask_webtest import TestApp 5 | 6 | from .core import app as app1 7 | from .core_sqlalchemy import app as app2, db, User 8 | 9 | 10 | class TestMainFeatures(unittest.TestCase): 11 | def setUp(self): 12 | self.app = app1 13 | self.w = TestApp(self.app) 14 | 15 | def test_single_template(self): 16 | r = self.w.get('/') 17 | self.assertFalse(r.flashes) 18 | self.assertEqual(len(r.contexts), 1) 19 | 20 | self.assertEqual(r.context['text'], 'Hello!') 21 | self.assertEqual(r.template, 'template.html') 22 | self.assertNotIn('qwerty', r.session) 23 | 24 | def test_two_templates_and_flash_messages(self): 25 | r = self.w.get('/').form.submit() 26 | self.assertEqual(len(r.contexts), 2) 27 | 28 | self.assertEqual(len(r.flashes), 2) 29 | category, message = r.flashes[0] 30 | self.assertEqual(message, 'You have pressed "Quit"...') 31 | 32 | category, message = r.flashes[1] 33 | self.assertEqual(message, 'Flash message that will never be shown') 34 | 35 | with self.assertRaises(AssertionError): 36 | r.context # Because there are more than one used templates 37 | self.assertEqual( 38 | r.contexts['template.html']['text'], 39 | 'Goodbye!') 40 | self.assertEqual( 41 | r.contexts['extra-template.html']['extra_text'], 42 | 'Some text.') 43 | 44 | def test_session_transaction(self): 45 | r = self.w.get('/whoami/') 46 | self.assertEqual(r.body.decode('utf-8'), 'nobody') 47 | 48 | with self.w.session_transaction() as sess: 49 | sess['username'] = 'aromanovich' 50 | 51 | r = self.w.get('/whoami/') 52 | 53 | self.assertEqual(r.session['username'], 'aromanovich') 54 | self.assertEqual(r.body.decode('utf-8'), 'aromanovich') 55 | 56 | def test_init(self): 57 | w = TestApp(self.app) 58 | self.assertEqual(w.get('/').status_code, 200) 59 | 60 | original_server_name = self.app.config['SERVER_NAME'] 61 | try: 62 | self.app.config['SERVER_NAME'] = 'webtest-app.local' 63 | w = TestApp(self.app) 64 | self.assertEqual(w.get('/').status_code, 200) 65 | finally: 66 | self.app.config['SERVER_NAME'] = original_server_name 67 | 68 | def test_localhost_session_transaction(self): 69 | ta = TestApp(self.app) 70 | resp = ta.get('/sess/save') 71 | assert resp.request.host == 'localhost:80' 72 | 73 | assert resp.status_code == 200 74 | cookies = list(ta.cookiejar) 75 | assert len(cookies) == 1 76 | 77 | sess_cookie = cookies[0] 78 | assert sess_cookie.domain == 'localhost.local' 79 | assert sess_cookie.name == 'session' 80 | 81 | with ta.session_transaction() as sess: 82 | sess['picard'] = 'enterprise' 83 | 84 | cookies = list(ta.cookiejar) 85 | assert len(cookies) == 1, cookies[1].domain 86 | 87 | resp = ta.get('/sess/get') 88 | assert resp.text == 'enterprisebar', resp.text 89 | 90 | class TestSQLAlchemyFeatures(unittest.TestCase): 91 | def setUp(self): 92 | self.app = app2 93 | self.w_without_scoping = TestApp(self.app) 94 | self.w = TestApp(self.app, db=db, use_session_scopes=True) 95 | 96 | self.app_context = self.app.app_context() 97 | self.app_context.push() 98 | db.create_all() 99 | 100 | def tearDown(self): 101 | db.drop_all() 102 | self.app_context.pop() 103 | 104 | def test_1(self): 105 | user = User(name='Anton') 106 | db.session.add(user) 107 | db.session.commit() 108 | 109 | r = self.w.get('/user/%i/' % user.id) 110 | self.assertEqual(r.body.decode('utf-8'), 'Hello, Anton!') 111 | 112 | # Note: we did not commit the change to `user`! 113 | user.name = 'Petr' 114 | 115 | r = self.w_without_scoping.get('/user/%i/' % user.id) 116 | self.assertEqual(r.body.decode('utf-8'), 'Hello, Petr!') 117 | 118 | r = self.w.get('/user/%i/' % user.id) 119 | self.assertEqual(r.body.decode('utf-8'), 'Hello, Anton!') 120 | 121 | def test_2(self): 122 | user = User(name='Anton') 123 | db.session.add(user) 124 | db.session.commit() 125 | 126 | r = self.w.get('/user/%i/' % user.id) 127 | self.assertEqual(r.body.decode('utf-8'), 'Hello, Anton!') 128 | 129 | r = self.w.post('/user/%i/preview/' % user.id, { 130 | 'greeting': 'Hi, %s.', 131 | }) 132 | self.assertEqual(r.body.decode('utf-8'), 'Hi, Anton.') 133 | db.session.refresh(user) 134 | 135 | r = self.w_without_scoping.post('/user/%i/preview/' % user.id, { 136 | 'greeting': 'Hi, %s.', 137 | }) 138 | self.assertEqual(r.body.decode('utf-8'), 'Hi, Anton.') 139 | self.assertRaises( 140 | sqlalchemy.exc.InvalidRequestError, 141 | lambda: db.session.refresh(user)) 142 | 143 | 144 | def suite(): 145 | suite = unittest.TestSuite() 146 | suite.addTest(unittest.makeSuite(TestMainFeatures)) 147 | suite.addTest(unittest.makeSuite(TestSQLAlchemyFeatures)) 148 | return suite 149 | 150 | 151 | if __name__ == '__main__': 152 | unittest.main(defaultTest='suite') 153 | -------------------------------------------------------------------------------- /tox.ini: -------------------------------------------------------------------------------- 1 | [tox] 2 | envlist = py{39,312}-lowest,py{39,310,311,312}-{base,stable},project,docs 3 | 4 | 5 | [testenv] 6 | # Ignore all "not installed in testenv" warnings. 7 | allowlist_externals = * 8 | skip_install = true 9 | # Force recreation of virtualenvs for each run. When testing in CI, this won't matter b/c the 10 | # virtualenvs won't exist in the container. When testing locally, if you've ran tox previously 11 | # then the libraries in the tox virtualenv won't get updated on pip-install. That means CI will 12 | # test different library versions than you are testing locally. Recreating virtualenvs should 13 | # prevent most of that mismatch. 14 | recreate=False 15 | commands = 16 | pip --version 17 | lowest: pip install flask<2.0.0 sqlalchemy~=1.4.1 flask-sqlalchemy~=2.5.1 markupsafe<2.1.0 18 | stable: pip install --progress-bar off -r ./stable-requirements.txt 19 | pip install --progress-bar off .[tests] 20 | # Output installed versions to compare with previous test runs in case a dependency's change 21 | # breaks things for our build. 22 | pip freeze 23 | ./test.sh 24 | 25 | [testenv:project] 26 | basepython = python3.9 27 | skip_install = true 28 | usedevelop = false 29 | deps = 30 | flake8 31 | twine 32 | commands = 33 | # check-manifest --ignore tox.ini,tests* 34 | python setup.py sdist 35 | twine check dist/* 36 | flake8 flask_webtest.py tests 37 | 38 | [flake8] 39 | exclude = .tox,*egg,build,.git,dist,docs 40 | max-line-length = 100 41 | ignore = E265,E123,E133,E226,E241,E242 42 | 43 | [testenv:docs] 44 | basepython = python3.9 45 | recreate = false 46 | skip_install = false 47 | usedevelop = true 48 | commands = 49 | pip install -r docs/requirements.txt 50 | make -C docs/ html 51 | -------------------------------------------------------------------------------- /version.py: -------------------------------------------------------------------------------- 1 | VERSION = '0.1.6' 2 | --------------------------------------------------------------------------------