Skip to content

Commit dd5e68e

Browse files
committed
README: convert from rst to md
pypi supports markdown from 2018 and it is better supported on github Also, it is easier to write. This commit makes no changes in the contents, only the format is changed with the aim to have an identical output on github for markdown. MANIFEST.in needed to be added because 'setup.py sdist' didn't include README.md in the source distribution.
1 parent 05dceaa commit dd5e68e

3 files changed

Lines changed: 27 additions & 38 deletions

File tree

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
include README.md
Lines changed: 24 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,46 @@
1-
|build| |doc|
1+
[![Build Status](https://travis-ci.org/csernazs/pytest-httpserver.svg?branch=master)](https://travis-ci.org/csernazs/pytest-httpserver)
2+
[![Documentation Status](https://readthedocs.org/projects/pytest-httpserver/badge/?version=latest)](https://pytest-httpserver.readthedocs.io/en/latest/?badge=latest)
23

4+
## pytest_httpserver
35

4-
pytest_httpserver
5-
=================
66
HTTP server for pytest
77

88

9-
Nutshell
10-
--------
9+
### Nutshell
1110

1211
This library is designed to help to test http clients without contacting the real http server.
1312
In other words, it is a fake http server which is accessible via localhost can be started with
1413
the pre-defined expected http requests and their responses.
1514

16-
Example
17-
-------
18-
19-
.. code-block:: python
20-
21-
def test_my_client(httpserver): # httpserver is a pytest fixture which starts the server
22-
# set up the server to serve /foobar with the json
23-
httpserver.expect_request("/foobar").respond_with_json({"foo": "bar"})
24-
# check that the request is served
25-
assert requests.get(httpserver.url_for("/foobar")).json() == {'foo': 'bar'}
15+
### Example
2616

17+
```python
18+
def test_my_client(httpserver): # httpserver is a pytest fixture which starts the server
19+
# set up the server to serve /foobar with the json
20+
httpserver.expect_request("/foobar").respond_with_json({"foo": "bar"})
21+
# check that the request is served
22+
assert requests.get(httpserver.url_for("/foobar")).json() == {'foo': 'bar'}
23+
```
2724

2825
You can also use the library without pytest. There's a with statement to ensure that the server is stopped.
2926

3027

31-
.. code-block:: python
28+
```python
29+
with HTTPServer() as httpserver:
30+
# set up the server to serve /foobar with the json
31+
httpserver.expect_request("/foobar").respond_with_json({"foo": "bar"})
32+
# check that the request is served
33+
print(requests.get(httpserver.url_for("/foobar")).json())
34+
```
3235

33-
with HTTPServer() as httpserver:
34-
# set up the server to serve /foobar with the json
35-
httpserver.expect_request("/foobar").respond_with_json({"foo": "bar"})
36-
# check that the request is served
37-
print(requests.get(httpserver.url_for("/foobar")).json())
3836

37+
### Features
3938

40-
Features
41-
--------
4239
You can set up a dozen of expectations for the requests, and also what response should be sent by the server to the client.
4340

4441

45-
Requests
46-
~~~~~~~~
42+
#### Requests
43+
4744
There are three different types:
4845

4946
- **permanent**: this will be always served when there's match for this request, you can make as many HTTP requests as you want
@@ -59,8 +56,7 @@ You can also fine-tune the expected request. The following can be specified:
5956
- data (HTTP payload of the request)
6057

6158

62-
Responses
63-
~~~~~~~~~
59+
#### Responses
6460

6561
Once you have the expectations for the request set up, you should also define the response you want to send back.
6662
The following is supported currently:
@@ -77,16 +73,7 @@ Similar to requests, you can fine-tune what response you want to send:
7773
- data
7874

7975

80-
Missing features
81-
----------------
76+
### Missing features
8277
* HTTP/2
8378
* Keepalive
8479
* TLS
85-
86-
87-
.. |build| image:: https://travis-ci.org/csernazs/pytest-httpserver.svg?branch=master
88-
:target: https://travis-ci.org/csernazs/pytest-httpserver
89-
90-
.. |doc| image:: https://readthedocs.org/projects/pytest-httpserver/badge/?version=latest
91-
:target: https://pytest-httpserver.readthedocs.io/en/latest/?badge=latest
92-
:alt: Documentation Status

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from setuptools import setup, find_packages
44

55

6-
DESCRIPTION = open("README.rst").read()
6+
DESCRIPTION = open("README.md").read()
77

88
setup(
99
name="pytest_httpserver",
@@ -15,6 +15,7 @@
1515
description="pytest-httpserver is a httpserver for pytest",
1616
entry_points={"pytest11": ["pytest_httpserver = pytest_httpserver.pytest_plugin"]},
1717
long_description=DESCRIPTION,
18+
long_description_content_type="text/markdown",
1819
python_requires=">=3.4",
1920
install_requires=[
2021
"typing;python_version<'3.5'",

0 commit comments

Comments
 (0)