Skip to content

Commit

Permalink
test: Fix failures due to changes in httpx
Browse files Browse the repository at this point in the history
  • Loading branch information
trallnag committed Dec 18, 2022
1 parent 067f6ae commit 1726297
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 9 deletions.
81 changes: 80 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions pyproject.toml
Expand Up @@ -30,6 +30,9 @@ devtools = "^0.9.0"
pre-commit = "^2.18.1"
asgiref = "^3.5.2"

[tool.poetry.group.dev.dependencies]
httpx = "^0.23.1"

[tool.black]
line-length = 90

Expand Down
16 changes: 8 additions & 8 deletions tests/test_metrics.py
Expand Up @@ -147,7 +147,7 @@ def test_request_size_all_labels():
Instrumentator().add(metrics.request_size()).instrument(app)
client = TestClient(app)

client.get("/", data="some data")
client.request(method="GET", url="/", data="some data")

assert (
REGISTRY.get_sample_value(
Expand All @@ -169,7 +169,7 @@ def test_request_size_no_labels():
).instrument(app)
client = TestClient(app)

client.get("/", data="some data")
client.request(method="GET", url="/", data="some data")

assert REGISTRY.get_sample_value("http_request_size_bytes_sum", {}) == 9

Expand Down Expand Up @@ -293,7 +293,7 @@ def test_combined_size_all_labels_with_data():
Instrumentator().add(metrics.combined_size()).instrument(app).expose(app)
client = TestClient(app)

client.get("/", data="fegfgeegeg")
client.request(method="GET", url="/", data="fegfgeegeg")

_ = get_response(client, "/metrics")

Expand Down Expand Up @@ -420,8 +420,8 @@ def test_default():
Instrumentator().add(metrics.default()).instrument(app).expose(app)
client = TestClient(app)

client.get("/", data="fefeef")
client.get("/")
client.request(method="GET", url="/", data="fefeef")
client.request(method="GET", url="/")

_ = get_response(client, "/metrics")

Expand Down Expand Up @@ -469,8 +469,8 @@ def test_default_should_only_respect_2xx_for_highr():
).instrument(app).expose(app)
client = TestClient(app)

client.get("/efefewffe", data="fefeef")
client.get("/ffe04904nfiuo-ni")
client.request(method="GET", url="/efefewffe", data="fefeef")
client.request(method="GET", url="/ffe04904nfiuo-ni")

response = get_response(client, "/metrics")

Expand All @@ -484,7 +484,7 @@ def test_default_should_not_only_respect_2xx_for_highr():
).instrument(app).expose(app)
client = TestClient(app)

client.get("/efefewffe", data="fefeef")
client.get("/efefewffe")
client.get("/ffe04904nfiuo-ni")

response = get_response(client, "/metrics")
Expand Down

0 comments on commit 1726297

Please sign in to comment.