Skip to content

The tests/test_runtime.py fails #406

@AKorezin

Description

@AKorezin

Summary

When I use pytest to test the 24.9.0 tag and the main branch, it fails.

Details

Test log
============================= test session starts ==============================
platform linux -- Python 3.12.6, pytest-8.3.3, pluggy-1.5.0
rootdir: /ansible-compat
configfile: pyproject.toml
testpaths: test
plugins: plus-0.7.0, mock-3.14.0
collected 108 items                                                            

test/test_api.py .                                                       [  0%]
test/test_config.py ..........                                           [ 10%]
test/test_configuration_example.py .                                     [ 11%]
test/test_loaders.py .                                                   [ 12%]
test/test_prerun.py .                                                    [ 12%]
test/test_runtime.py .......................................F........... [ 60%]
...................................                                      [ 92%]
test/test_runtime_example.py .                                           [ 93%]
test/test_runtime_scan_path.py ..                                        [ 95%]
test/test_schema.py ...                                                  [ 98%]
test/test_types.py .                                                     [ 99%]
test/test_version.py .                                                   [100%]

=================================== FAILURES ===================================
_______________________ test_require_collection_install ________________________

runtime_tmp = <ansible_compat.runtime.Runtime object at 0x742cba1d95e0>

    def test_require_collection_install(runtime_tmp: Runtime) -> None:
        """Check that require collection successful install case, including upgrade path."""
        runtime_tmp.install_collection("ansible.posix:==1.5.2")
        runtime_tmp.load_collections()
        collection = runtime_tmp.collections["ansible.posix"]
        assert collection.version == "1.5.2"
        runtime_tmp.require_collection(name="ansible.posix", version="1.5.4", install=True)
        runtime_tmp.load_collections()
        collection = runtime_tmp.collections["ansible.posix"]
>       assert collection.version == "1.5.4"
E       AssertionError: assert '1.6.0' == '1.5.4'
E         
E         - 1.5.4
E         + 1.6.0

test/test_runtime.py:461: AssertionError
=========================== short test summary info ============================
FAILED test/test_runtime.py::test_require_collection_install - AssertionError: assert '1.6.0' == '1.5.4'
================== 1 failed, 107 passed in 130.92s (0:02:10) ===================

Reproduction

  1. I use docker run -it --rm python:3.12-slim bash to start a container.
  2. apt-get update
    apt-get install git
    git clone https://github.com/ansible/ansible-compat.git
    cd ansible-compat/
    python -m venv .venv
    . .venv/bin/activate
    pip install -r .config/requirements.in
    pip install -r .config/requirements-test.in
    pip install -e .
    pytest

Versions

  • python: 3.12.6
  • ansible-compat: 24.9.0, d07db24
  • pip freeze
    ansible-core==2.17.4
    attrs==24.2.0
    build==1.2.2
    cffi==1.17.1
    click==8.1.7
    coverage==7.6.1
    cryptography==43.0.1
    iniconfig==2.0.0
    Jinja2==3.1.4
    jsonschema==4.23.0
    jsonschema-specifications==2023.12.1
    MarkupSafe==2.1.5
    packaging==24.1
    pip-tools==7.4.1
    pluggy==1.5.0
    pycparser==2.22
    pyproject_hooks==1.1.0
    pytest==8.3.3
    pytest-mock==3.14.0
    pytest-plus==0.7.0
    PyYAML==6.0.2
    referencing==0.35.1
    resolvelib==1.0.1
    rpds-py==0.20.0
    setuptools==74.1.2
    subprocess-tee==0.4.2
    wheel==0.44.0
    

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions