JustPaste.it
User avatar
@anonymous · Apr 6, 2024

vscode ➜ /workspaces/howto-weaviate-retrieval-plugin (playing) $ poetry shell
maSpawning shell within /workspaces/howto-weaviate-retrieval-plugin/.venv
vscode ➜ /workspaces/howto-weaviate-retrieval-plugin (playing) $ . /workspaces/howto-weaviate-retrieval-plugin/.venv/bin/activate
(howto-weaviate-retrieval-plugin-py3.11) vscode ➜ /workspaces/howto-weaviate-retrieval-plugin (playing) $ make test
poetry run pytest --cov server --cov-report term-missing -v -s tests -m 'not expensive'
==================================================================== test session starts ====================================================================
platform linux -- Python 3.11.4, pytest-7.4.0, pluggy-1.2.0 -- /workspaces/howto-weaviate-retrieval-plugin/.venv/bin/python
cachedir: .pytest_cache
rootdir: /workspaces/howto-weaviate-retrieval-plugin
configfile: pyproject.toml
plugins: cov-4.1.0, anyio-3.7.1
collected 7 items / 1 deselected / 6 selected                                                                                                               
tests/server/test_database.py::test_init_db navnavnav setting up server
WARN[0000] /workspaces/howto-weaviate-retrieval-plugin/tests/docker-compose.yml: `version` is obsolete 
[+] Running 2/2
 ✔ Network tests_default       Created                                                                                                                  0.0s 
 ✔ Container tests-weaviate-1  Started                                                                                                                  0.2s 
FAILEDWARN[0000] /workspaces/howto-weaviate-retrieval-plugin/tests/docker-compose.yml: `version` is obsolete 
[+] Running 2/2
 ✔ Container tests-weaviate-1  Removed                                                                                                                  0.1s 
 ✔ Network tests_default       Removed                                                                                                                  0.0s 
tests/server/test_main.py::test_read_root navnavnav hello get/
PASSED
tests/server/test_main.py::test_weaviate_server navnavnav setting up server
WARN[0000] /workspaces/howto-weaviate-retrieval-plugin/tests/docker-compose.yml: `version` is obsolete 
[+] Running 2/2
 ✔ Network tests_default       Created                                                                                                                  0.0s 
 ✔ Container tests-weaviate-1  Started                                                                                                                  0.0s 
PASSED
tests/server/test_main.py::test_upsert BEARER NAVNAV:  Y78WSNpVhljr4f9OVFGmGloNLY3ArNSRTYJF
2  Y78WSNpVhljr4f9OVFGmGloNLY3ArNSRTYJF
navnavnav hello
1ce6d80b-23b4-4802-a08e-83ad405f6f4f
navnav res is {'deprecations': None, 'objects': []}
navnav docs is []
FAILED
tests/server/test_main.py::test_query BEARER NAVNAV:  Y78WSNpVhljr4f9OVFGmGloNLY3ArNSRTYJF
2  Y78WSNpVhljr4f9OVFGmGloNLY3ArNSRTYJF
navnavnav hello
e07939d3-1ed7-401e-ad9b-423edbddf3c3
BEARER NAVNAV:  Y78WSNpVhljr4f9OVFGmGloNLY3ArNSRTYJF
2  Y78WSNpVhljr4f9OVFGmGloNLY3ArNSRTYJF
navnavnav hello
f33f0486-edab-4b3c-b95d-b82847138310
BEARER NAVNAV:  Y78WSNpVhljr4f9OVFGmGloNLY3ArNSRTYJF
2  Y78WSNpVhljr4f9OVFGmGloNLY3ArNSRTYJF
navnavnav hello
11672aae-2722-4c2f-ae6a-d38287937e82
BEARER NAVNAV:  Y78WSNpVhljr4f9OVFGmGloNLY3ArNSRTYJF
2  Y78WSNpVhljr4f9OVFGmGloNLY3ArNSRTYJF
navnavnav hello
ae993636-5288-4270-9be3-53d5461fbca2
BEARER NAVNAV:  Y78WSNpVhljr4f9OVFGmGloNLY3ArNSRTYJF
2  Y78WSNpVhljr4f9OVFGmGloNLY3ArNSRTYJF
navnavnav hello
aa84916a-06b4-481d-b66f-ccd9a4193e64
BEARER NAVNAV:  Y78WSNpVhljr4f9OVFGmGloNLY3ArNSRTYJF
2  Y78WSNpVhljr4f9OVFGmGloNLY3ArNSRTYJF
PASSED
tests/server/test_main.py::test_delete BEARER NAVNAV:  Y78WSNpVhljr4f9OVFGmGloNLY3ArNSRTYJF
2  Y78WSNpVhljr4f9OVFGmGloNLY3ArNSRTYJF
navnavnav hello
68746ace-934b-45e3-a075-5d2a2294c3cb
BEARER NAVNAV:  Y78WSNpVhljr4f9OVFGmGloNLY3ArNSRTYJF
2  Y78WSNpVhljr4f9OVFGmGloNLY3ArNSRTYJF
navnavnav hello
fb55e749-b8f8-40cd-9ce1-df1ac79a28d0
BEARER NAVNAV:  Y78WSNpVhljr4f9OVFGmGloNLY3ArNSRTYJF
2  Y78WSNpVhljr4f9OVFGmGloNLY3ArNSRTYJF
navnavnav hello
3cd6d3fd-72e2-4417-85e8-c36917652d0a
BEARER NAVNAV:  Y78WSNpVhljr4f9OVFGmGloNLY3ArNSRTYJF
2  Y78WSNpVhljr4f9OVFGmGloNLY3ArNSRTYJF
navnavnav hello
2575c08c-cb9e-4a70-952f-9e1210058128
BEARER NAVNAV:  Y78WSNpVhljr4f9OVFGmGloNLY3ArNSRTYJF
2  Y78WSNpVhljr4f9OVFGmGloNLY3ArNSRTYJF
navnavnav hello
7f3e76e1-a74e-4b90-8aba-d6d9d9149d47
FAILEDWARN[0000] /workspaces/howto-weaviate-retrieval-plugin/tests/docker-compose.yml: `version` is obsolete 
[+] Running 2/2
 ✔ Container tests-weaviate-1  Removed                                                                                                                  0.1s 
 ✔ Network tests_default       Removed                                                                                                                  0.0s 
========================================================================= FAILURES ==========================================================================
_______________________________________________________________________ test_init_db ________________________________________________________________________
caplog = <_pytest.logging.LogCaptureFixture object at 0xffff947e2fd0>, weaviate_client = <weaviate.client.Client object at 0xffff947e2f10>
    def test_init_db(caplog, weaviate_client):
        """
        Test the database initialization
        """
        weaviate_client.schema.delete_all()
    
        with caplog.at_level(logging.DEBUG):
            database.init_db()
>           assert "Creating schema" in caplog.text
E           assert 'Creating schema' in 'DEBUG    urllib3.connectionpool:connectionpool.py:1048 Starting new HTTPS connection (1): sandbox-ty1t8yec.weaviate.network:443\nDEBUG    urllib3.connectionpool:connectionpool.py:546 https://sandbox-ty1t8yec.weaviate.network:443 "GET /v1/.well-known/ready HTTP/1.1" 200 0\nDEBUG    urllib3.connectionpool:connectionpool.py:1048 Starting new HTTPS connection (1): sandbox-ty1t8yec.weaviate.network:443\nDEBUG    urllib3.connectionpool:connectionpool.py:546 https://sandbox-ty1t8yec.weaviate.network:443 "GET /v1/.well-known/openid-configuration HTTP/1.1" 404 0\nDEBUG    urllib3.connectionpool:connectionpool.py:1048 Starting new HTTPS connection (1): sandbox-ty1t8yec.weaviate.network:443\nDEBUG    urllib3.connectionpool:connectionpool.py:546 https://sandbox-ty1t8yec.weaviate.network:443 "GET /v1/meta HTTP/1.1" 200 1811\nDEBUG    urllib3.connectionpool:connectionpool.py:1048 Starting new HTTPS connection (1): pypi.org:443\nDEBUG    urllib3.connectionpool:connectionpool.py:546 https://pypi.org:443 "GET /pypi/weaviate-client/json HTTP/1.1" 200 49836\nDEBUG    urllib3.connectionpool:connectionpool.py:546 https://sandbox-ty1t8yec.weaviate.network:443 "GET /v1/schema HTTP/1.1" 200 1138\nDEBUG    root:database.py:39 Schema for Document already exists\nDEBUG    root:database.py:40 Skipping schema creation\n'
E            +  where 'DEBUG    urllib3.connectionpool:connectionpool.py:1048 Starting new HTTPS connection (1): sandbox-ty1t8yec.weaviate.network:443\nDEBUG    urllib3.connectionpool:connectionpool.py:546 https://sandbox-ty1t8yec.weaviate.network:443 "GET /v1/.well-known/ready HTTP/1.1" 200 0\nDEBUG    urllib3.connectionpool:connectionpool.py:1048 Starting new HTTPS connection (1): sandbox-ty1t8yec.weaviate.network:443\nDEBUG    urllib3.connectionpool:connectionpool.py:546 https://sandbox-ty1t8yec.weaviate.network:443 "GET /v1/.well-known/openid-configuration HTTP/1.1" 404 0\nDEBUG    urllib3.connectionpool:connectionpool.py:1048 Starting new HTTPS connection (1): sandbox-ty1t8yec.weaviate.network:443\nDEBUG    urllib3.connectionpool:connectionpool.py:546 https://sandbox-ty1t8yec.weaviate.network:443 "GET /v1/meta HTTP/1.1" 200 1811\nDEBUG    urllib3.connectionpool:connectionpool.py:1048 Starting new HTTPS connection (1): pypi.org:443\nDEBUG    urllib3.connectionpool:connectionpool.py:546 https://pypi.org:443 "GET /pypi/weaviate-client/json HTTP/1.1" 200 49836\nDEBUG    urllib3.connectionpool:connectionpool.py:546 https://sandbox-ty1t8yec.weaviate.network:443 "GET /v1/schema HTTP/1.1" 200 1138\nDEBUG    root:database.py:39 Schema for Document already exists\nDEBUG    root:database.py:40 Skipping schema creation\n' = <_pytest.logging.LogCaptureFixture object at 0xffff947e2fd0>.text
tests/server/test_database.py:13: AssertionError
--------------------------------------------------------------------- Captured log call ---------------------------------------------------------------------
DEBUG    urllib3.connectionpool:connectionpool.py:1048 Starting new HTTPS connection (1): sandbox-ty1t8yec.weaviate.network:443
DEBUG    urllib3.connectionpool:connectionpool.py:546 https://sandbox-ty1t8yec.weaviate.network:443 "GET /v1/.well-known/ready HTTP/1.1" 200 0
DEBUG    urllib3.connectionpool:connectionpool.py:1048 Starting new HTTPS connection (1): sandbox-ty1t8yec.weaviate.network:443
DEBUG    urllib3.connectionpool:connectionpool.py:546 https://sandbox-ty1t8yec.weaviate.network:443 "GET /v1/.well-known/openid-configuration HTTP/1.1" 404 0
DEBUG    urllib3.connectionpool:connectionpool.py:1048 Starting new HTTPS connection (1): sandbox-ty1t8yec.weaviate.network:443
DEBUG    urllib3.connectionpool:connectionpool.py:546 https://sandbox-ty1t8yec.weaviate.network:443 "GET /v1/meta HTTP/1.1" 200 1811
DEBUG    urllib3.connectionpool:connectionpool.py:1048 Starting new HTTPS connection (1): pypi.org:443
DEBUG    urllib3.connectionpool:connectionpool.py:546 https://pypi.org:443 "GET /pypi/weaviate-client/json HTTP/1.1" 200 49836
DEBUG    urllib3.connectionpool:connectionpool.py:546 https://sandbox-ty1t8yec.weaviate.network:443 "GET /v1/schema HTTP/1.1" 200 1138
DEBUG    root:database.py:39 Schema for Document already exists
DEBUG    root:database.py:40 Skipping schema creation
________________________________________________________________________ test_upsert ________________________________________________________________________
weaviate_client = <weaviate.client.Client object at 0xffff94851210>
    def test_upsert(weaviate_client):
        #print("NAVNAV BEARER " + BEARER_TOKEN)
        response = client.post("/upsert", json={"text": "Hello World", "document_id": "1"})
        assert response.status_code == 200
    
        res = weaviate_client.data_object.get(with_vector=True)
        print("navnav res is", res)
        docs = weaviate_client.data_object.get(with_vector=True)["objects"]
        print("navnav docs is", docs)
>       assert len(docs) == 1
E       assert 0 == 1
E        +  where 0 = len([])
tests/server/test_main.py:46: AssertionError
________________________________________________________________________ test_delete ________________________________________________________________________
documents = None, weaviate_client = <weaviate.client.Client object at 0xffff94806c90>
    def test_delete(documents, weaviate_client):
>       num_docs_before_delete = weaviate_client.data_object.get()["totalResults"]
E       KeyError: 'totalResults'
tests/server/test_main.py:64: KeyError
---------- coverage: platform linux, python 3.11.4-final-0 -----------
Name                  Stmts   Miss  Cover   Missing
---------------------------------------------------
server/__init__.py        0      0   100%
server/database.py       18      2    89%   35-36
server/embedding.py       4      0   100%
server/main.py           64      7    89%   27, 52-53, 152-164
---------------------------------------------------
TOTAL                    86      9    90%
================================================================== short test summary info ==================================================================
FAILED tests/server/test_database.py::test_init_db - assert 'Creating schema' in 'DEBUG    urllib3.connectionpool:connectionpool.py:1048 Starting new HTTPS connection (1): sandbox-ty1t8yec.weaviate.network...
FAILED tests/server/test_main.py::test_upsert - assert 0 == 1
FAILED tests/server/test_main.py::test_delete - KeyError: 'totalResults'
======================================================== 3 failed, 3 passed, 1 deselected in 17.48s =========================================================
make: *** [makefile:8: test] Error 1
(howto-weaviate-retrieval-plugin-py3.11) vscode ➜ /workspaces/howto-weaviate-retrieval-plugin (playing) $