Skip to content

Commit b59c63a

Browse files
committed
blocking_http_server: rename classes and module
Rename 'Http' to 'HTTP' to be consistent. Rename 'blocking_http_server.py' for the same reason. 'Http' would be a better choice but we don't want to have API incompatibility and as HTTP is all uppercase everywhere it is better to keep aligned with that.
1 parent 902801c commit b59c63a

6 files changed

Lines changed: 17 additions & 17 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ Similar to requests, you can fine-tune what response you want to send:
103103
#### Behave support
104104

105105
Using the `BlockingHttpServer` class, the assertion for a request and the response can be performed in real order.
106-
For more info, see the [test](tests/test_blocking_http_server.py) and the API documentation.
106+
For more info, see the [test](tests/test_blocking_httpserver.py) and the API documentation.
107107

108108

109109
### Missing features

pytest_httpserver/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
"URIPattern",
1414
"URI_DEFAULT",
1515
"METHOD_ALL",
16-
"BlockingHttpServer",
16+
"BlockingHTTPServer",
1717
]
1818

19-
from .blocking_http_server import BlockingHttpServer
19+
from .blocking_httpserver import BlockingHTTPServer
2020
from .httpserver import METHOD_ALL
2121
from .httpserver import URI_DEFAULT
2222
from .httpserver import Error
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from pytest_httpserver.httpserver import METHOD_ALL
1414
from pytest_httpserver.httpserver import UNDEFINED
1515
from pytest_httpserver.httpserver import HeaderValueMatcher
16-
from pytest_httpserver.httpserver import HttpServerBase
16+
from pytest_httpserver.httpserver import HTTPServerBase
1717
from pytest_httpserver.httpserver import QueryMatcher
1818
from pytest_httpserver.httpserver import RequestHandlerBase
1919
from pytest_httpserver.httpserver import URIPattern
@@ -33,7 +33,7 @@ def respond_with_response(self, response: Response):
3333
self.response_queue.put_nowait(response)
3434

3535

36-
class BlockingHttpServer(HttpServerBase):
36+
class BlockingHTTPServer(HTTPServerBase):
3737
"""
3838
Server instance which enables synchronous matching for incoming requests.
3939

pytest_httpserver/httpserver.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ class HandlerType(Enum):
567567
ORDERED = "ordered"
568568

569569

570-
class HttpServerBase(abc.ABC): # pylint: disable=too-many-instance-attributes
570+
class HTTPServerBase(abc.ABC): # pylint: disable=too-many-instance-attributes
571571
"""
572572
Abstract HTTP server with error handling.
573573
@@ -841,7 +841,7 @@ def __exit__(self, *args, **kwargs):
841841
self.stop()
842842

843843

844-
class HTTPServer(HttpServerBase): # pylint: disable=too-many-instance-attributes
844+
class HTTPServer(HTTPServerBase): # pylint: disable=too-many-instance-attributes
845845
"""
846846
Server instance which manages handlers to serve pre-defined requests.
847847
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import pytest
77
import requests
88

9-
from pytest_httpserver import BlockingHttpServer
9+
from pytest_httpserver import BlockingHTTPServer
1010

1111

1212
@contextmanager
@@ -42,7 +42,7 @@ def then_the_response_is_got_from(server_connection, response):
4242

4343
@pytest.fixture
4444
def httpserver():
45-
server = BlockingHttpServer(timeout=1)
45+
server = BlockingHTTPServer(timeout=1)
4646
server.start()
4747

4848
yield server
@@ -52,7 +52,7 @@ def httpserver():
5252
server.stop()
5353

5454

55-
def test_behave_workflow(httpserver: BlockingHttpServer):
55+
def test_behave_workflow(httpserver: BlockingHTTPServer):
5656
request = dict(
5757
method="GET",
5858
url=httpserver.url_for("/my/path"),
@@ -69,7 +69,7 @@ def test_behave_workflow(httpserver: BlockingHttpServer):
6969
then_the_response_is_got_from(server_connection, response)
7070

7171

72-
def test_raises_assertion_error_when_request_does_not_match(httpserver: BlockingHttpServer):
72+
def test_raises_assertion_error_when_request_does_not_match(httpserver: BlockingHTTPServer):
7373
request = dict(
7474
method="GET",
7575
url=httpserver.url_for("/my/path"),
@@ -84,15 +84,15 @@ def test_raises_assertion_error_when_request_does_not_match(httpserver: Blocking
8484
assert "does not match" in str(exc)
8585

8686

87-
def test_raises_assertion_error_when_request_was_not_sent(httpserver: BlockingHttpServer):
87+
def test_raises_assertion_error_when_request_was_not_sent(httpserver: BlockingHTTPServer):
8888
with pytest.raises(AssertionError) as exc:
8989
httpserver.assert_request(uri="/my/path/", timeout=1)
9090

9191
assert "/my/path/" in str(exc)
9292
assert "timed out" in str(exc)
9393

9494

95-
def test_ignores_when_request_is_not_asserted(httpserver: BlockingHttpServer):
95+
def test_ignores_when_request_is_not_asserted(httpserver: BlockingHTTPServer):
9696
request = dict(
9797
method="GET",
9898
url=httpserver.url_for("/my/path"),
@@ -103,7 +103,7 @@ def test_ignores_when_request_is_not_asserted(httpserver: BlockingHttpServer):
103103
assert server_connection.get(timeout=9).text == "No handler found for this request"
104104

105105

106-
def test_raises_assertion_error_when_request_was_not_responded(httpserver: BlockingHttpServer):
106+
def test_raises_assertion_error_when_request_was_not_responded(httpserver: BlockingHTTPServer):
107107
request = dict(
108108
method="GET",
109109
url=httpserver.url_for("/my/path"),

tests/test_release.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ def test_wheel_no_extra_contents(build: Build, version: str):
137137
package_contents = {path.name for path in wheel_dir.joinpath(NAME_UNDERSCORE).iterdir()}
138138
assert package_contents == {
139139
"__init__.py",
140-
"blocking_http_server.py",
140+
"blocking_httpserver.py",
141141
"httpserver.py",
142142
"py.typed",
143143
"pytest_plugin.py",
@@ -178,15 +178,15 @@ def test_sdist_contents(build: Build, version: str):
178178
},
179179
"pytest_httpserver": {
180180
"__init__.py",
181-
"blocking_http_server.py",
181+
"blocking_httpserver.py",
182182
"httpserver.py",
183183
"py.typed",
184184
"pytest_plugin.py",
185185
},
186186
"tests": {
187187
"assets",
188188
"conftest.py",
189-
"test_blocking_http_server.py",
189+
"test_blocking_httpserver.py",
190190
"test_handler_errors.py",
191191
"test_headers.py",
192192
"test_json_matcher.py",

0 commit comments

Comments
 (0)