Skip to content

pytest might escape virtualenv in invoke #27

Open

Description

@benoit74

@rgaudin said:

Found an issue: by calling pytest directly in invoke, it might escape a virtualenv if it's not activated (env/bin/inv coverage).
Can be fixed with:

    pyexe = shlex.quote(sys.executable)
    ctx.run(f"{pyexe} -m pytest {args}", pty=use_pty)

Activity

  1. changed the title [-]pytest might escape [/-] [+]pytest might escape virtualenv in invoke[/+] on Aug 16, 2023
  2. benoit74 commented on Aug 16, 2023

    @benoit74
    CollaboratorAuthor

    Question: is is true also for other tools (coverage, ruff, black, pyright, ...)?

  3. added
    enhancement
    on Aug 16, 2023
  4. rgaudin commented on Aug 16, 2023

    @rgaudin
    Member

    Most likely. I found this when you switched to pytest command because I had an out-of-venv pytest with a different version.

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

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions