Skip to content

Commit 4ce7da8

Browse files
beliaev-maksimcsernazs
authored andcommitted
apply all hooks
1 parent 41b088d commit 4ce7da8

36 files changed

Lines changed: 386 additions & 278 deletions

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
"python.formatting.autopep8Path": "${workspaceFolder}/.venv/bin/autopep8",
1414
"python.linting.mypyEnabled": true,
1515
"python.linting.mypyPath": "${workspaceFolder}/.venv/bin/mypy",
16-
}
16+
}

CHANGES.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,4 +378,3 @@ Prelude
378378
-------
379379

380380
First release
381-

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ dev: venv
1515

1616
.PHONY: precommit
1717
precommit: venv
18-
pre-commit run -a -v
18+
pre-commit run -a
1919

2020
.PHONY: mypy
2121
mypy: venv

README.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,28 @@ the pre-defined expected http requests and their responses.
1919

2020
#### Handling a simple GET request
2121
```python
22-
def test_my_client(httpserver): # httpserver is a pytest fixture which starts the server
22+
def test_my_client(
23+
httpserver,
24+
): # httpserver is a pytest fixture which starts the server
2325
# set up the server to serve /foobar with the json
2426
httpserver.expect_request("/foobar").respond_with_json({"foo": "bar"})
2527
# check that the request is served
26-
assert requests.get(httpserver.url_for("/foobar")).json() == {'foo': 'bar'}
28+
assert requests.get(httpserver.url_for("/foobar")).json() == {"foo": "bar"}
2729
```
2830

2931
#### Handing a POST request with an expected json body
3032
```python
31-
def test_json_request(httpserver): # httpserver is a pytest fixture which starts the server
33+
def test_json_request(
34+
httpserver,
35+
): # httpserver is a pytest fixture which starts the server
3236
# set up the server to serve /foobar with the json
33-
httpserver.expect_request("/foobar", method="POST", json={"id": 12, "name": "foo"}).respond_with_json({"foo": "bar"})
37+
httpserver.expect_request(
38+
"/foobar", method="POST", json={"id": 12, "name": "foo"}
39+
).respond_with_json({"foo": "bar"})
3440
# check that the request is served
35-
assert requests.post(httpserver.url_for("/foobar"), json={"id": 12, "name": "foo"}).json() == {'foo': 'bar'}
41+
assert requests.post(
42+
httpserver.url_for("/foobar"), json={"id": 12, "name": "foo"}
43+
).json() == {"foo": "bar"}
3644
```
3745

3846

doc/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ help:
1717
# Catch-all target: route all unknown targets to Sphinx using the new
1818
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
1919
%: Makefile
20-
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

doc/api.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,3 @@ by the user.
7474

7575
.. autoclass:: pytest_httpserver.httpserver.RequestHandlerList
7676
:members:
77-

doc/background.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ Example:
4343
.. code-block:: python
4444
4545
def test_query_params(httpserver):
46-
httpserver.expect_request("/foo", query_string={"user": "user1"}).respond_with_data("OK")
46+
httpserver.expect_request("/foo", query_string={"user": "user1"}).respond_with_data(
47+
"OK"
48+
)
4749
4850
It is simple in the most simple cases, but once the expectation is more
4951
specific, the line can grow significantly, so here the user is expected to put
@@ -52,7 +54,9 @@ the literals into variables:
5254
.. code-block:: python
5355
5456
def test_query_params(httpserver):
55-
httpserver.expect_request("/foo", query_string=expected_query).respond_with_data("OK")
57+
httpserver.expect_request("/foo", query_string=expected_query).respond_with_data(
58+
"OK"
59+
)
5660
5761
5862
If the user wants something more complex, classes are available for this which

doc/conf.py

Lines changed: 44 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
1818
# documentation root, use os.path.abspath to make it absolute, like shown here.
1919
#
2020

21-
from typing import Dict
22-
2321
import os
2422
import sys
25-
sys.path.insert(0, os.path.abspath('..'))
23+
from typing import Dict
24+
25+
sys.path.insert(0, os.path.abspath(".."))
2626

2727

2828
# -- General configuration ------------------------------------------------
@@ -35,38 +35,38 @@
3535
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
3636
# ones.
3737
extensions = [
38-
'sphinx.ext.autodoc',
39-
'sphinx.ext.intersphinx',
38+
"sphinx.ext.autodoc",
39+
"sphinx.ext.intersphinx",
4040
]
4141

4242
intersphinx_mapping = {
43-
'python': ('https://docs.python.org/3', (None, 'python-inv.txt')),
44-
'werkzeug': ('https://werkzeug.palletsprojects.com/en/2.1.x', None)
43+
"python": ("https://docs.python.org/3", (None, "python-inv.txt")),
44+
"werkzeug": ("https://werkzeug.palletsprojects.com/en/2.1.x", None),
4545
}
4646

4747
# Add any paths that contain templates here, relative to this directory.
48-
templates_path = ['_templates']
48+
templates_path = ["_templates"]
4949

5050
# The suffix(es) of source filenames.
5151
# You can specify multiple suffix as a list of string:
5252
#
5353
# source_suffix = ['.rst', '.md']
54-
source_suffix = '.rst'
54+
source_suffix = ".rst"
5555

5656
# The master toctree document.
57-
master_doc = 'index'
57+
master_doc = "index"
5858

5959
# General information about the project.
60-
project = 'pytest_httpserver'
61-
copyright = '2020, Zsolt Cserna'
62-
author = 'Zsolt Cserna'
60+
project = "pytest_httpserver"
61+
copyright = "2020, Zsolt Cserna"
62+
author = "Zsolt Cserna"
6363

6464
# The version info for the project you're documenting, acts as replacement for
6565
# |version| and |release|, also used in various other places throughout the
6666
# built documents.
6767
#
6868
# The short X.Y version.
69-
version = '1.0.4'
69+
version = "1.0.4"
7070
# The full version, including alpha/beta/rc tags.
7171
release = version
7272

@@ -80,10 +80,10 @@
8080
# List of patterns, relative to source directory, that match files and
8181
# directories to ignore when looking for source files.
8282
# This patterns also effect to html_static_path and html_extra_path
83-
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
83+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
8484

8585
# The name of the Pygments (syntax highlighting) style to use.
86-
pygments_style = 'sphinx'
86+
pygments_style = "sphinx"
8787

8888
# If true, `todo` and `todoList` produce output, else they produce nothing.
8989
todo_include_todos = False
@@ -94,7 +94,7 @@
9494
# The theme to use for HTML and HTML Help pages. See the documentation for
9595
# a list of builtin themes.
9696
#
97-
html_theme = 'sphinx_rtd_theme'
97+
html_theme = "sphinx_rtd_theme"
9898

9999
# Theme options are theme-specific and customize the look and feel of a theme
100100
# further. For a list of options available for each theme, see the
@@ -103,42 +103,42 @@
103103
# html_theme_options = {}
104104

105105
html_theme_options = {
106-
'canonical_url': '',
107-
'analytics_id': '',
108-
'logo_only': False,
109-
'display_version': True,
110-
'prev_next_buttons_location': 'bottom',
111-
'style_external_links': False,
106+
"canonical_url": "",
107+
"analytics_id": "",
108+
"logo_only": False,
109+
"display_version": True,
110+
"prev_next_buttons_location": "bottom",
111+
"style_external_links": False,
112112
# Toc options
113-
'collapse_navigation': True,
114-
'sticky_navigation': True,
115-
'navigation_depth': 4,
116-
'includehidden': True,
117-
'titles_only': False
113+
"collapse_navigation": True,
114+
"sticky_navigation": True,
115+
"navigation_depth": 4,
116+
"includehidden": True,
117+
"titles_only": False,
118118
}
119119

120120
# Add any paths that contain custom static files (such as style sheets) here,
121121
# relative to this directory. They are copied after the builtin static files,
122122
# so a file named "default.css" will overwrite the builtin "default.css".
123-
html_static_path = ['_static']
123+
html_static_path = ["_static"]
124124

125125
# Custom sidebar templates, must be a dictionary that maps document names
126126
# to template names.
127127
#
128128
# This is required for the alabaster theme
129129
# refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars
130130
html_sidebars = {
131-
'**': [
132-
'relations.html', # needs 'show_related': True theme option to display
133-
'searchbox.html',
131+
"**": [
132+
"relations.html", # needs 'show_related': True theme option to display
133+
"searchbox.html",
134134
]
135135
}
136136

137137

138138
# -- Options for HTMLHelp output ------------------------------------------
139139

140140
# Output file base name for HTML help builder.
141-
htmlhelp_basename = 'pytest_httpserverdoc'
141+
htmlhelp_basename = "pytest_httpserverdoc"
142142

143143

144144
# -- Options for LaTeX output ---------------------------------------------
@@ -147,15 +147,12 @@
147147
# The paper size ('letterpaper' or 'a4paper').
148148
#
149149
# 'papersize': 'letterpaper',
150-
151150
# The font size ('10pt', '11pt' or '12pt').
152151
#
153152
# 'pointsize': '10pt',
154-
155153
# Additional stuff for the LaTeX preamble.
156154
#
157155
# 'preamble': '',
158-
159156
# Latex figure (float) alignment
160157
#
161158
# 'figure_align': 'htbp',
@@ -165,19 +162,15 @@
165162
# (source start file, target name, title,
166163
# author, documentclass [howto, manual, or own class]).
167164
latex_documents = [
168-
(master_doc, 'pytest_httpserver.tex', 'pytest\\_httpserver Documentation',
169-
'Zsolt Cserna', 'manual'),
165+
(master_doc, "pytest_httpserver.tex", "pytest\\_httpserver Documentation", "Zsolt Cserna", "manual"),
170166
]
171167

172168

173169
# -- Options for manual page output ---------------------------------------
174170

175171
# One entry per manual page. List of tuples
176172
# (source start file, name, description, authors, manual section).
177-
man_pages = [
178-
(master_doc, 'pytest_httpserver', 'pytest_httpserver Documentation',
179-
[author], 1)
180-
]
173+
man_pages = [(master_doc, "pytest_httpserver", "pytest_httpserver Documentation", [author], 1)]
181174

182175

183176
# -- Options for Texinfo output -------------------------------------------
@@ -186,7 +179,13 @@
186179
# (source start file, target name, title, author,
187180
# dir menu entry, description, category)
188181
texinfo_documents = [
189-
(master_doc, 'pytest_httpserver', 'pytest_httpserver Documentation',
190-
author, 'pytest_httpserver', 'One line description of project.',
191-
'Miscellaneous'),
182+
(
183+
master_doc,
184+
"pytest_httpserver",
185+
"pytest_httpserver Documentation",
186+
author,
187+
"pytest_httpserver",
188+
"One line description of project.",
189+
"Miscellaneous",
190+
),
192191
]

0 commit comments

Comments
 (0)