Skip to content

running tests in parallel with tox p fails #2899

Description

@davidism

Running tests in parallel with tox p fails, meaning I have to run all local test envs serially right now. It seems that the detected terminal environment is different in parallel mode, causing the pager tests to fail.

FAILED tests/test_utils.py::test_echo_via_pager[test0-cat] - AssertionError: Unexpected pager output in test case 'Plain string argument'

Activity

  1. Rowlando13 commented on May 12, 2025

    @Rowlando13
    Member

    Shouldn't it fail? Don't some test s use click's testing which is not thread safe.

  2. davidism commented on May 12, 2025

    @davidism
    MemberAuthor

    It worked until the changes to the pager, and only fail on the pager test. I made sure everything ran correctly with tox p in all projects, it makes pre-checking a PR way faster.

  3. Rowlando13 commented on May 12, 2025

    @Rowlando13
    Member

    I agree. What did you do? I was just planning on looking some tests

  4. Rowlando13 commented on May 12, 2025

    @Rowlando13
    Member

    There are multiple instances of this:

    def test_file_args(runner):
        @click.command()
        @click.argument("input", type=click.File("rb"))
        @click.argument("output", type=click.File("wb"))
        def inout(input, output):
            while True:
                chunk = input.read(1024)
                if not chunk:
                    break
                output.write(chunk)
    
        with runner.isolated_filesystem():
            result = runner.invoke(inout, ["-", "hello.txt"], input="Hey!")
            assert result.output == ""
            assert result.exit_code == 0
            with open("hello.txt", "rb") as f:
                assert f.read() == b"Hey!"
    
            result = runner.invoke(inout, ["hello.txt", "-"])
            assert result.output == "Hey!"
            assert result.exit_code == 0

    Seems like the isolated_filesystem() would not be thread safe.

  5. added this to the 8.4.1 milestone on May 21, 2026
  6. davidism commented on May 22, 2026

    @davidism
    MemberAuthor

    Seems to work now.

  7. modified the milestones: 8.4.1, 8.5.0 on May 22, 2026
  8. kdeldycke commented on May 22, 2026

    @kdeldycke
    Collaborator

    Running tests in parallel with tox p fails, meaning I have to run all local test envs serially right now. It seems that the detected terminal environment is different in parallel mode, causing the pager tests to fail.

    FAILED tests/test_utils.py::test_echo_via_pager[test0-cat] - AssertionError: Unexpected pager output in test case 'Plain string argument'
    

    This part has been already fixed by #3238 which is available in Click 8.3.3.

  9. kdeldycke commented on May 22, 2026

    @kdeldycke
    Collaborator

    Seems like the isolated_filesystem() would not be thread safe.

    It is not. So I move this concern to a dedicated issue at: #3501

    That way this current issue can be marked as closed and addressed in Click 8.4.2 once #3499 is merged, as it will make the tests properly running in parallels, as the original issue suggested.

  10. modified the milestones: 8.5.0, 8.4.2 on May 22, 2026
  11. locked as resolved and limited conversation to collaborators on Jul 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    test runnerCliRunner and Click's test utilities feature

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions