Skip to content

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

@gone-for-coding

Description

@gone-for-coding
SUMMARY

The comment aa8ddef#diff-40cad2763ec8aa722046788c29c9ef0f9dcfcbdcc5ca34cbaaaca2fbdbe4ed95R54-R56 should not be placed in an assert statement as it breaks pre-compilation with python -m compielall.

ISSUE TYPE
  • Bug Report
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'...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions