Skip to content

Commit

Permalink
Correct psycopg requirements (#225)
Browse files Browse the repository at this point in the history
This fixes a bug that prevented the execution of the tests on some
platforms, such macos, as psycopg listed alone does not always
installs a funcitonal library:

E   ImportError: no pq wrapper available.
E   Attempts made:
E   - couldn't import psycopg 'c' implementation: No module named 'psycopg_c'
E   - couldn't import psycopg 'binary' implementation: No module named 'psycopg_binary'
E   - couldn't import psycopg 'python' implementation: libpq library not found

Also enables testing on macos, preventing such a regression.
  • Loading branch information
ssbarnea authored Aug 6, 2024
1 parent 838bc04 commit d13c6c3
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/tox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
other_names: |
lint
integration
platforms: linux
platforms: linux,macos
build:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os || 'ubuntu-22.04' }}
Expand Down Expand Up @@ -67,7 +67,8 @@ jobs:
path: ansible_collections/ansible/eda
submodules: true

- name: Install package dependencies
- name: Install package dependencies (ubuntu)
if: ${{ contains(matrix.os, 'ubuntu') }}
run: |
sudo apt-get update
sudo apt-get --assume-yes --no-install-recommends install libsystemd0 libsystemd-dev pkg-config
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ aiokafka
azure-servicebus
dpath
kafka-python
psycopg
psycopg[binary,pool] # extras needed to avoid install failure on macos-aarch64
systemd-python; sys_platform != 'darwin'
watchdog
xxhash
2 changes: 1 addition & 1 deletion tests/unit/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ azure-servicebus
dpath
pytest<8 # https://github.com/ansible/ansible/issues/82713
pytest-asyncio
psycopg
psycopg[binary,pool]
xxhash
2 changes: 2 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ deps = -r test_requirements.txt
commands_pre =
bash -c 'test "$(basename $(cd ../.. && pwd))" == ansible_collections || { echo "Repository must be cloned inside a directory structure like ansible_collections/ansible/eda in order allow ansible-test to run."; exit 3;}'
commands =
# fail-fast if psycopg in not properly installed.
python3 -c "import psycopg"
ansible-test sanity
ansible-test units --venv -v --num-workers 1
allowlist_externals =
Expand Down

0 comments on commit d13c6c3

Please sign in to comment.