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

Now testing Python 3.12 #168

Merged
merged 4 commits into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python_version: [2-slim, 3.5-slim, 3.6-slim, 3.7-slim, 3.8-slim, 3.9-slim, 3.10-slim, 3.11-slim]
python_version: [2-slim, 3.5-slim, 3.6-slim, 3.7-slim, 3.8-slim, 3.9-slim, 3.10-slim, 3.11-slim, 3.12-slim]
group: [1, 2]
scenario:
- default
Expand All @@ -24,10 +24,10 @@ jobs:
run: |
set -e
docker info
- name: Set up Python 3.11
- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: "3.11"
python-version: "3.12"
- name: Install dependencies
run: |
pip install -r test-requirements.txt
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/python-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.11
- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: "3.11"
python-version: "3.12"
- name: Install dependencies
run: |
pip install -r requirements.txt
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,7 @@ This library is tested with the following versions of Python:
* Python 3.9
* Python 3.10
* Python 3.11
* Python 3.12

## Ansible compatibility
To date, this library is compatible with all known versions of Ansible 2.X (`ansible`/`ansible-core` 2.X).
Expand Down
3 changes: 3 additions & 0 deletions library/kafka_acl.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
import logging
import sys

# XXX: fix kafka-python import broken for Python 3.12
import ansible.module_utils.kafka_fix_import # noqa

from ansible.module_utils.basic import AnsibleModule

from ansible.module_utils.kafka_lib_acl import process_module_acl
Expand Down
3 changes: 3 additions & 0 deletions library/kafka_acls.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
import logging
import sys

# XXX: fix kafka-python import broken for Python 3.12
import ansible.module_utils.kafka_fix_import # noqa

from ansible.module_utils.basic import AnsibleModule

from ansible.module_utils.kafka_lib_acl import process_module_acls
Expand Down
3 changes: 3 additions & 0 deletions library/kafka_consumer_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@

from pkg_resources import parse_version

# XXX: fix kafka-python import broken for Python 3.12
import ansible.module_utils.kafka_fix_import # noqa

from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.pycompat24 import get_exception
from kafka.errors import KafkaError
Expand Down
3 changes: 3 additions & 0 deletions library/kafka_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@

from pkg_resources import parse_version

# XXX: fix kafka-python import broken for Python 3.12
import ansible.module_utils.kafka_fix_import # noqa

from ansible.module_utils.ansible_release import __version__ as ansible_version

# import module snippets
Expand Down
3 changes: 3 additions & 0 deletions library/kafka_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
import logging
import sys

# XXX: fix kafka-python import broken for Python 3.12
import ansible.module_utils.kafka_fix_import # noqa

from ansible.module_utils.basic import AnsibleModule

from ansible.module_utils.kafka_lib_acl import process_module_acl
Expand Down
3 changes: 3 additions & 0 deletions library/kafka_quotas.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
import logging
import sys

# XXX: fix kafka-python import broken for Python 3.12
import ansible.module_utils.kafka_fix_import # noqa

from ansible.module_utils.basic import AnsibleModule

from ansible.module_utils.kafka_lib_quotas import process_module_quotas
Expand Down
3 changes: 3 additions & 0 deletions library/kafka_stat_lag.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
# import module snippets
import json

# XXX: fix kafka-python import broken for Python 3.12
import ansible.module_utils.kafka_fix_import # noqa

from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.pycompat24 import get_exception
from kafka.errors import KafkaError
Expand Down
3 changes: 3 additions & 0 deletions library/kafka_topic.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
import logging
import sys

# XXX: fix kafka-python import broken for Python 3.12
import ansible.module_utils.kafka_fix_import # noqa

from ansible.module_utils.basic import AnsibleModule

from ansible.module_utils.kafka_lib_topic import process_module_topic
Expand Down
3 changes: 3 additions & 0 deletions library/kafka_topics.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
import logging
import sys

# XXX: fix kafka-python import broken for Python 3.12
import ansible.module_utils.kafka_fix_import # noqa

from ansible.module_utils.basic import AnsibleModule

from ansible.module_utils.kafka_lib_topic import process_module_topics
Expand Down
3 changes: 3 additions & 0 deletions library/kafka_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
import logging
import sys

# XXX: fix kafka-python import broken for Python 3.12
import ansible.module_utils.kafka_fix_import # noqa

from ansible.module_utils.basic import AnsibleModule

from ansible.module_utils.kafka_lib_user import (
Expand Down
3 changes: 3 additions & 0 deletions library/kafka_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
import logging
import sys

# XXX: fix kafka-python import broken for Python 3.12
import ansible.module_utils.kafka_fix_import # noqa

from ansible.module_utils.basic import AnsibleModule

from ansible.module_utils.kafka_lib_user import (
Expand Down
7 changes: 7 additions & 0 deletions module_utils/kafka_fix_import.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import sys
import types

if sys.version_info >= (3, 12, 0):
m = types.ModuleType('kafka.vendor.six.moves', 'Mock module')
setattr(m, 'range', range)
sys.modules['kafka.vendor.six.moves'] = m
6 changes: 3 additions & 3 deletions molecule/default/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ dependency:
name: galaxy
driver:
name: docker
lint: |
yamllint .
#lint: |
# yamllint .
platforms:
#########################################################
# Executors
Expand Down Expand Up @@ -404,7 +404,7 @@ provisioner:
scenario:
name: default
create_sequence:
- lint
#- lint
- destroy
- dependency
- syntax
Expand Down
7 changes: 7 additions & 0 deletions molecule/default/tests/ansible_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
import json
import six
import testinfra
import sys
import types

if sys.version_info >= (3, 12, 0):
m = types.ModuleType('kafka.vendor.six.moves', 'Mock module')
setattr(m, 'range', range)
sys.modules['kafka.vendor.six.moves'] = m

from pkg_resources import parse_version

Expand Down
6 changes: 3 additions & 3 deletions molecule/scram-kafka-270/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ dependency:
name: galaxy
driver:
name: docker
lint: |
yamllint .
#lint: |
# yamllint .
platforms:
#########################################################
# Executors
Expand Down Expand Up @@ -142,7 +142,7 @@ provisioner:
scenario:
name: scram-kafka-270
create_sequence:
- lint
# - lint
- destroy
- dependency
- syntax
Expand Down
7 changes: 7 additions & 0 deletions molecule/scram-kafka-270/tests/test_users.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
import time
import uuid
import sys
import types

if sys.version_info >= (3, 12, 0):
m = types.ModuleType('kafka.vendor.six.moves', 'Mock module')
setattr(m, 'range', range)
sys.modules['kafka.vendor.six.moves'] = m

from kafka import KafkaConsumer, KafkaProducer, TopicPartition

Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
kafka-python>=2.0.0,<2.1.0
kazoo==2.6.1
pure-sasl==0.5.1
setuptools; python_version >= '3.12'
16 changes: 8 additions & 8 deletions test-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
urllib3<2.0.0
ansible==7.3.0
ansible-compat==3.0.1
ansible==8.5.0
ansible-compat==4.1.11
ansible-lint==6.14.2
funcsigs
molecule==4.0.4
molecule==6.0.3
molecule-plugins[docker]==23.0.0
pytest-testinfra==6.1.0
pytest-xdist==2.2.1
pytest-instafail==0.4.2
pytest-split==0.3.3
pytest-timeout==1.4.2
pytest-testinfra==10.0.0
pytest-xdist==3.5.0
pytest-instafail==0.5.0
pytest-split==0.8.2
pytest-timeout==2.2.0
flake8==5.0.4
2 changes: 1 addition & 1 deletion tests/module_utils/test_kafka_acls.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

import module_utils.kafka_fix_import # noqa
from module_utils.kafka_acl import ACLResourceType as rs
from module_utils.kafka_acl import ACLOperation as op
from module_utils.kafka_acl import (
Expand Down
1 change: 1 addition & 0 deletions tests/module_utils/test_kafka_scram.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import pytest

import module_utils.kafka_fix_import # noqa
from module_utils import kafka_scram


Expand Down
Loading