Source: ormar
Version: 0.12.0-1
Severity: serious
Tag: ftbfs
Dear Maintainer,
ormar currently fails to build from source for two reasons. The first is
several error message like these when running the test suite:
Traceback:
/usr/lib/python3.10/importlib/__init__.py:126: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
tests/test_fastapi/test_skip_reverse_models.py:8: in <module>
from starlette.testclient import TestClient
/usr/lib/python3/dist-packages/starlette/testclient.py:16: in <module>
import httpx
E ModuleNotFoundError: No module named 'httpx'
_________ ERROR collecting tests/test_fastapi/test_wekref_exclusion.py
_________
(Taken from the build log when the package got synced to Ubuntu, but
I've also reproduced this on Sid
https://launchpadlibrarian.net/638906557/buildlog_ubuntu-lunar-amd64.ormar_0.12.0-1_BUILDING.txt.gz)
These errors are the easy part, it simply needs
python3-httpx
added as a build dependency. With this in place, the build result
changes from 19 errors to 2 failing tests. I don't know why they are
failing though, whether it is due to api changes in the test client
used, or the functionality of the package.
=================================== FAILURES
===================================
______________________________ test_all_endpoints
______________________________
def test_all_endpoints():
client = TestClient(app)
with client as client:
item = {
"name": "test",
"categories": [{"name": "test cat"}, {"name": "test
cat2"}],
}
response = client.post("/items/", json=item)
item_check = Item(**response.json())
assert item_check.id is not None
assert item_check.categories[0].id is not None
no_pk_item = client.get(f"/items/{item_check.id}",
json=item).json()
E TypeError: TestClient.get() got an unexpected keyword
argument 'json'
tests/test_fastapi/test_excluding_fields.py:118: TypeError
______________________________ test_all_endpoints
______________________________
def test_all_endpoints():
client = TestClient(app)
with client as client:
response = client.post("/categories/", json={"name": "test
cat"})
category = response.json()
response = client.post(
"/items/", json={"name": "test", "id": 1, "category":
category}
)
item = Item(**response.json())
assert item.pk is not None
response = client.get("/items/")
items = [Item(**item) for item in response.json()]
assert items[0] == item
item.name = "New name"
response = client.put(f"/items/{item.pk}", json=item.dict())
assert response.json() == item.dict()
response = client.get("/items/")
items = [Item(**item) for item in response.json()]
assert items[0].name == "New name"
response = client.get("/items/raw/")
items = [Item(**item) for item in response.json()]
assert items[0].name == "New name"
assert items[0].category.name is None
response = client.get(f"/items/{item.pk}")
new_item = Item(**response.json())
assert new_item == item
response = client.delete(f"/items/{item.pk}")
assert response.json().get("deleted_rows", "__UNDEFINED__")
!= "__UNDEFINED__"
response = client.get("/items/")
items = response.json()
assert len(items) == 0
client.post("/items/", json={"name": "test_2", "id": 2,
"category": category})
response = client.get("/items/")
items = response.json()
assert len(items) == 1
item = Item(**items[0])
response = client.delete(f"/items/{item.pk}",
json=item.dict())
E TypeError: TestClient.delete() got an unexpected keyword
argument 'json'
tests/test_fastapi/test_more_reallife_fastapi.py:150: TypeError
-- System Information:
Debian Release: bookworm/sid
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)
Kernel: Linux 6.0.0-5-amd64 (SMP w/3 CPU threads; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8),
LANGUAGE=en_US:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
--
mvh / best regards
Hans Joachim Desserud
http://desserud.org