Custom commands for Pytest build step

I'm using Python implementation of Playwright framework.

To install it I have to

  • create virtual environment (venv)
  • install all requirements from requirements.txt
  • run command `python -m playwright install chromium`

I tried to use the default Python runner type in 2 steps:

  1. Command=module; module=playwright; Script or module arguments=install chromium; Environment tool=venv
  2. Command=pytest; Environment tool=venv

This approach forces the build to run venv creation/activation and pip install -r requirements.txt two times which I want to avoid.
Is there any workaround to run `python -m playwright install chromium` after requirements install and before pytest launch?

I know that I can create several custom scripted steps to reproduce the behaviour of standard Python runner with pytest command but I want to configure standard one.

Comment actions Permalink
In order to help you further, may I ask why it’s a problem to run creating/activating twice? The virtual environment creation tool venv should perform with respect to the already created environment and pip install should not install dependencies again (unless there is something specific with playwright?).
Thank you,
Comment actions Permalink

Guilherme Barbosa

I just wanted to avoid installing requirements twice. That's all.

Thank you for answer


Please sign in to leave a comment.