Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In the test dependencies install psycopg with extra binary #992

Merged
merged 3 commits into from
Nov 19, 2024

Conversation

HK-Mattew
Copy link
Contributor

Changes

Fixes #.

Checklist

If this is a user-facing code change, like a bugfix or a new feature, please ensure that
you've fulfilled the following conditions (where applicable):

  • You've added tests (in tests/) added which would fail without your patch
  • You've updated the documentation (in docs/, in case of behavior changes or new
    features)
  • You've added a new changelog entry (in docs/versionhistory.rst).

If this is a trivial change, like a typo fix or a code reformatting, then you can ignore
these instructions.

Updating the changelog

If there are no entries after the last release, use **UNRELEASED** as the version.
If, say, your patch fixes issue #999, the entry should look like this:

* Fix big bad boo-boo in the async scheduler (#999 <https://github.com/agronholm/apscheduler/issues/999>_; PR by @yourgithubaccount)

If there's no issue linked, just link to your pull request instead by updating the
changelog after you've created the PR.

@agronholm
Copy link
Owner

Why?

@HK-Mattew
Copy link
Contributor Author

Why?

Before, when installing the requirements with just the command:
pip install -e .[test]

And then running the tests, all tests related to psycopg were skipped saying that psycopg was not installed.

@HK-Mattew
Copy link
Contributor Author

HK-Mattew commented Nov 19, 2024

Maybe this didn't happen to you because you already had the requirements installed on your system before installing psycopg.

@coveralls
Copy link

Coverage Status

coverage: 92.033%. remained the same
when pulling 28d6c68 on HK-Mattew:master
into d01ad31 on agronholm:master.

@agronholm
Copy link
Owner

Then why is it not happening in the CI either? https://github.com/agronholm/apscheduler/actions/runs/11903322842/job/33170050358

@HK-Mattew
Copy link
Contributor Author

Then why is it not happening in the CI either? https://github.com/agronholm/apscheduler/actions/runs/11903322842/job/33170050358

These CI systems probably already come with several requirements installed. (Docker type that is already installed)

@agronholm
Copy link
Owner

The log output does not support that supposition:

 Installing collected packages: uwsgi, sortedcontainers, tzlocal, typing-extensions, tomli, tenacity, sniffio, six, shiboken6, pymysql, pycparser, pluggy, paho-mqtt, packaging, iniconfig, idna, greenlet, exceptiongroup, dnspython, coverage, cbor2, attrs, asyncmy, async-timeout, sqlalchemy, redis, python-dateutil, pytest, PySide6-Essentials, pymongo, psycopg, outcome, cffi, asyncpg, anyio, aiosqlite, trio, time-machine, pytest-mock, pytest-lazy-fixtures, PySide6-Addons, cryptography, APScheduler, PySide6
Successfully installed APScheduler-0.0.post1 PySide6-6.8.0.2 PySide6-Addons-6.8.0.2 PySide6-Essentials-6.8.0.2 aiosqlite-0.20.0 anyio-4.6.2.post1 async-timeout-5.0.1 asyncmy-0.2.9 asyncpg-0.30.0 attrs-24.2.0 cbor2-5.6.5 cffi-1.17.1 coverage-7.6.7 cryptography-43.0.3 dnspython-2.7.0 exceptiongroup-1.2.2 greenlet-3.1.1 idna-3.10 iniconfig-2.0.0 outcome-1.3.0.post0 packaging-24.2 paho-mqtt-2.1.0 pluggy-1.5.0 psycopg-3.2.3 pycparser-2.22 pymongo-4.10.1 pymysql-1.1.1 pytest-8.3.3 pytest-lazy-fixtures-1.1.1 pytest-mock-3.14.0 python-dateutil-2.9.0.post0 redis-5.2.0 shiboken6-6.8.0.2 six-1.16.0 sniffio-1.3.1 sortedcontainers-2.4.0 sqlalchemy-2.0.36 tenacity-9.0.0 time-machine-2.16.0 tomli-2.1.0 trio-0.27.0 typing-extensions-4.12.2 tzlocal-5.2 uwsgi-2.0.26

@agronholm
Copy link
Owner

Could this be an artifact of missing libpq5 or something? Could you try to import/use psycopg directly to see what error you get?

@agronholm
Copy link
Owner

Reading the installation docs, it seems clear that libpq5 is indeed required always, and is probably missing from your local system.

@agronholm
Copy link
Owner

This is what I get when trying to import psycopg in a container running python:3.12-slim:

>>> import psycopg
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.12/site-packages/psycopg/__init__.py", line 9, in <module>
    from . import pq  # noqa: F401 import early to stabilize side effects
    ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/psycopg/pq/__init__.py", line 117, in <module>
    import_from_libpq()
  File "/usr/local/lib/python3.12/site-packages/psycopg/pq/__init__.py", line 109, in import_from_libpq
    raise ImportError(
ImportError: no pq wrapper available.
Attempts made:
- couldn't import psycopg 'c' implementation: No module named 'psycopg_c'
- couldn't import psycopg 'binary' implementation: No module named 'psycopg_binary'
- couldn't import psycopg 'python' implementation: libpq library not found

@agronholm agronholm merged commit ec80485 into agronholm:master Nov 19, 2024
14 checks passed
@HK-Mattew
Copy link
Contributor Author

Reading the installation docs, it seems clear that libpq5 is indeed required always, and is probably missing from your local system.

Exactly that, the lack of this requirement in the system caused pytest to skip the tests related to psycopg, claiming that it was not installed.

Therefore, adding the extra binary solves these operating system requirement problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants