ansible-collections / community.postgresql

Manage PostgreSQL with Ansible
https://galaxy.ansible.com/ui/repo/published/community/postgresql/
Other
111 stars 90 forks source link

Comment in unit test with invalid syntax breaks pre-compile #737

Closed gone-for-coding closed 2 months ago

gone-for-coding commented 2 months ago
SUMMARY

The comment https://github.com/ansible-collections/community.postgresql/commit/aa8ddef71e2e25babdb47c8ae13d1348b46a8cad#diff-40cad2763ec8aa722046788c29c9ef0f9dcfcbdcc5ca34cbaaaca2fbdbe4ed95R54-R56 should not be placed in an assert statement as it breaks pre-compilation with python -m compielall.

ISSUE TYPE
COMPONENT NAME

tests/unit/plugins/modules/test_postgresql_user.py

ANSIBLE VERSION
not relevant
COLLECTION VERSION
# /usr/share/ansible/collections/ansible_collections
Collection           Version
-------------------- -------
community.postgresql 3.6.0
CONFIGURATION
none
OS / ENVIRONMENT
root@ee92370aee13:/code# cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

root@ee92370aee13:/code# python --version
Python 3.12.5
STEPS TO REPRODUCE

Install version 3.6.0 of the collection and pre-compile all files.

ansible-galaxy collection install --force --collections-path /usr/share/ansible/collections community.postgresql
python -m compileall /usr/share/ansible
echo $?
EXPECTED RESULTS

No errors.

ACTUAL RESULTS
Compiling '/usr/share/ansible/collections/ansible_collections/community/postgresql/tests/unit/plugins/modules/test_postgresql_user.py'...
***   File "/usr/share/ansible/collections/ansible_collections/community/postgresql/tests/unit/plugins/modules/test_postgresql_user.py", line 55
    # TODO the following two lines were added because the assertion above fails
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: invalid syntax
Listing '/usr/share/ansible/collections/ansible_collections/community/postgresql/tests/utils'...
Andersson007 commented 2 months ago

@gone-for-coding hello, thanks a lot for reporting the issue! I've just publish 3.6.1 with the comment moved out from the wrong position, please upgrade and try again, thanks

gone-for-coding commented 2 months ago

@Andersson007 wow that was a quick fix. Everything looking good now. Thanks a lot!