### Summary

In Fedora, we are testing the impact of pytest 7.0.0rc1 on our packages. Both `ansible` 2.9.27 and `ansible-core` 2.12.1 fail with various different errors. 

ansible:

    = 1836 failed, 8451 passed, 711 skipped, 7 warnings, 12 errors in 665.67s (0:11:05) =

ansible-core:

    =========== 25 failed, 1768 passed, 11 skipped, 7 warnings in 49.19s ===========

### Issue Type

Bug Report

### Component Name

test?

### Ansible Version

```console
2.9.27
```


### Configuration

```console
N/A
```


### OS / Environment

Fedora Linux 36, Python 3.10.1, pytest 7.0.0rc1

### Steps to Reproduce

In Fedora, we build the packages in this copr: https://copr.fedorainfracloud.org/coprs/churchyard/pytest-7/

Unfortunately, I don't know ansible much and I don't know how you run the tests, but should be reproducible if you install a pre-release pytest to the environment.

### Expected Results

The tests should pass, as they do with pytest 6.2.5.

### Actual Results

- Actual results for ansible: [ansible-builder-live.log.gz](https://github.com/ansible/ansible/files/7734616/ansible-builder-live.log.gz)
- Actual results for ansible-core: [ansible-core-builder-live.log.gz](https://github.com/ansible/ansible/files/7734617/ansible-core-builder-live.log.gz)

Also available at https://copr.fedorainfracloud.org/coprs/churchyard/pytest-7/package/ansible/ and https://copr.fedorainfracloud.org/coprs/churchyard/pytest-7/package/ansible-core/

### Code of Conduct

- [X] I agree to follow the Ansible Code of Conduct
mock_ntf = mocker.MagicMock()
    mock_ntf.write = mocker.MagicMock()
    mock_ntf.close = mocker.MagicMock()
    mock_ntf.name = None
    return mock_ntf
@pytest.fixture(autouse=True)
def init_test(monkeypatch):
    monkeypatch.setattr(tempfile, 'NamedTemporaryFile', mock_NamedTemporaryFile)
@pytest.fixture(autouse=True)
def mock_role_download_api(mocker, monkeypatch):
    mock_role_api = mocker.MagicMock()
    mock_role_api.side_effect = [
        StringIO(u''),
    ]
    monkeypatch.setattr(role, 'open_url', mock_role_api)
    return mock_role_api
def test_role_download_github(mocker, galaxy_server, mock_role_download_api, monkeypatch):
    mock_api = mocker.MagicMock()
    mock_api.side_effect = [
        StringIO(u'{"available_versions":{"v1":"v1/"}}'),
        StringIO(u'{"results":[{"id":"123","github_user":"test_owner","github_repo": "test_role"}]}'),
        StringIO(u'{"results":[{"name": "0.0.1"},{"name": "0.0.2"}]}'),
    ]
    monkeypatch.setattr(api, 'open_url', mock_api)
    role.GalaxyRole(Galaxy(), galaxy_server, 'test_owner.test_role', version="0.0.1").install()
    assert mock_role_download_api.call_count == 1
    assert mock_role_download_api.mock_calls[0][1][0] == 'https://github.com/test_owner/test_role/archive/0.0.1.tar.gz'
def test_role_download_github_default_version(mocker, galaxy_server, mock_role_download_api, monkeypatch):