diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7a8403831..635ed2ccf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -62,6 +62,9 @@ jobs: - name: '3.11' tox_env: integration-py311 + - name: '3.12' + tox_env: integration-py312 + steps: - name: Checkout uses: actions/checkout@v3 @@ -124,6 +127,9 @@ jobs: - name: '3.11' tox_env: unit-py311 + - name: '3.12' + tox_env: unit-py312 + steps: - name: Checkout uses: actions/checkout@v3 diff --git a/setup.cfg b/setup.cfg index 24dbe7e35..3d3125bcb 100644 --- a/setup.cfg +++ b/setup.cfg @@ -21,6 +21,7 @@ classifiers = Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 Programming Language :: Python :: 3.11 + Programming Language :: Python :: 3.12 Programming Language :: Python :: 3 :: Only Topic :: Software Development :: Libraries :: Python Modules Topic :: System :: Systems Administration diff --git a/src/ansible_runner/display_callback/callback/awx_display.py b/src/ansible_runner/display_callback/callback/awx_display.py index 007a493f3..7eef80a34 100644 --- a/src/ansible_runner/display_callback/callback/awx_display.py +++ b/src/ansible_runner/display_callback/callback/awx_display.py @@ -70,7 +70,7 @@ def current_time(): - return datetime.datetime.utcnow().replace(tzinfo=datetime.timezone.utc) + return datetime.datetime.now(datetime.timezone.utc) # use a custom JSON serializer so we can properly handle !unsafe and !vault diff --git a/src/ansible_runner/runner.py b/src/ansible_runner/runner.py index 1b6a103a1..062205476 100644 --- a/src/ansible_runner/runner.py +++ b/src/ansible_runner/runner.py @@ -82,7 +82,7 @@ def event_callback(self, event_data): # prefer 'created' from partial data, but verbose events set time here if 'created' not in event_data: - event_data['created'] = datetime.datetime.utcnow().replace(tzinfo=datetime.timezone.utc).isoformat() + event_data['created'] = datetime.datetime.now(datetime.timezone.utc).isoformat() if self.event_handler is not None: should_write = self.event_handler(event_data) diff --git a/test/requirements.txt b/test/requirements.txt index c227d90c2..565292c1b 100644 --- a/test/requirements.txt +++ b/test/requirements.txt @@ -1,6 +1,6 @@ mypy==1.6.0 pylint==3.0.1 -pytest==7.1.2 +pytest==8.1.1 pytest-cov pytest-mock pytest-timeout diff --git a/tox.ini b/tox.ini index 02bc5851a..ef540923f 100644 --- a/tox.ini +++ b/tox.ini @@ -14,16 +14,16 @@ deps = ansible27: ansible<2.8 ansible29: ansible<2.10 ansible-base: ansible-base py{,3,39,310,311}: ansible-core - integration{,-py39,-py310,-py311}: ansible-core - build - -r {toxinidir}/test/requirements.txt + integration{,-py39,-py310,-py311,-py312}: ansible-core + build + -r {toxinidir}/test/requirements.txt passenv = HOME RUNNER_TEST_IMAGE_NAME usedevelop = True commands = pytest -vv -n auto {posargs} -[testenv:linters{,-py39,-py310,-py311}] +[testenv:linters{,-py39,-py310,-py311,-py312}] description = Run code linters commands = flake8 --version @@ -33,11 +33,11 @@ commands = mypy src/ansible_runner pylint src/ansible_runner test -[testenv:unit{,-py39,-py310,-py311}] +[testenv:unit{,-py39,-py310,-py311,-py312}] description = Run unit tests commands = pytest -vv -n auto {posargs:test/unit} {[shared]pytest_cov_args} -[testenv:integration{,-py39,-py310,-py311}] +[testenv:integration{,-py39,-py310,-py311,-py312}] description = Run integration tests commands = pytest -vv -n auto {posargs:test/integration} {[shared]pytest_cov_args}