Adding a directory to the PATH variable can be as simple as running export PATH=$PATH:/path/to/dir
. What I'm trying to achieve is to have pytest run this command before anything else happens so that I can set the browser drivers to PATH (instead of moving them to /usr/local/bin
as I prefer to change PATH temporarily).
Couple obvious workarounds are:
- Manually executing the above command before starting pytest
- Using a separate Python file to wrap around pytest
My attempt after looking through several SO posts was to play around with various pytest_
methods such as pytest_configure
in conftest.py
but this did not work as pytest failed to see the specified directory in PATH.
Is there a way to incorporate this command into pytest framework so I don't have to explore these workarounds?