Skip to content

Fix linting with multiple workers in Python 3.12 #495

@reuterbal

Description

@reuterbal

What happened?

For some reason, Linting with multiple workers does not work reliably in Python 3.12 (but is fine in Python 3.11 and 3.13). The test test_linter_lint_files_glob in loki/lint/tests/test_linter.py fails with 4 workers on the following line:

checked_files = Path(target_file_name).read_text().splitlines()
assert len(checked_files) == counter

Because the string read from target_file_name is empty - however, when interrupting the test in this place and checking the file content manually shows the expected content. This suggests a race condition of sorts, which may even be specific to the test implementation and not affecting the actual linter behaviour.

What are the steps to reproduce the bug?

Run pytest on Python 3.12

Version

0.3.0-dev

Platform (OS and architecture)

GH Actions (Ubuntu 24.04) and JEDI

Relevant log output

Accompanying data

No response

Organisation

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions