atest task loses python interpreter when running with virtualenv under Windows
See original GitHub issueFor issues
Steps to reproduce the issue
Under Windows
mkdir atest-python-interpreter
cd atest-python-interpreter
virtualenv -p C:\Python39\python.exe venv-py39
venv-py39\Scripts\activate
git clone git@github.com:robotframework/SeleniumLibrary.git rf-sl
cd rf-sl
pip install -r requirements-dev.txt
inv atest
The last command results in an error
(venv-py39) D:\devsandbox\atest-python-interpreter\rf-sl>inv atest
Traceback (most recent call last):
File "D:\devsandbox\atest-python-interpreter\rf-sl\utest\run.py", line 9, in <module>
from pytest import main as py_main
ModuleNotFoundError: No module named 'pytest'
Not running acceptance test, because unit tests failed.
Error messages and additional information
The last command results in an error
(venv-py39) D:\devsandbox\atest-python-interpreter\rf-sl>inv atest
Traceback (most recent call last):
File "D:\devsandbox\atest-python-interpreter\rf-sl\utest\run.py", line 9, in <module>
from pytest import main as py_main
ModuleNotFoundError: No module named 'pytest'
Not running acceptance test, because unit tests failed.
I am running under Windows 10 using Python 3.9.9 within a virtual env
Expected behavior and actual behavior
I was expecting the runner to use the virtual env I have executed with. But instead it appeas to run python
from a process not realizing it is a virtualenv that it was started under.
Environment
Browser: Name and version (Usually available from the about dialogue.) Browser driver: Name and version Operating System: Windows 10 Libraries
- Robot Framework: 5.0.1
- Selenium: 4.5.0
- SeleniumLibrary: 6.1.0.dev1
- Interpreter: Python 3.9.9 under a virtualenv
(venv-py39) C:\projects\SeleniumLibrary\atest-python-interpreter\rf-sl>pip list
Package Version
---------------------------- -----------
[ ... snip ...]
pytest 7.1.3
pytest-approvaltests 0.2.4
pytest-mockito 0.0.4
[ ... snip ...]
Issue Analytics
- State:
- Created a year ago
- Comments:11 (11 by maintainers)
Top Results From Across the Web
Support poetry virtual environments · Issue #8372 - GitHub
after creating the virtual environment with poetry it was not been detected by vscode in python interpreter selection (shift+cmd+p) even after ...
Read more >VS Code task and Python virtual environment - Stack Overflow
When I run it, it doesn't use my venv even though it is the selected interpreter. I've tried to add a activate venv/......
Read more >Python Virtual Environments: A Primer
In this tutorial, you'll learn how to work with Python's venv module to create and manage separate virtual environments for your Python ......
Read more >venv — Creation of virtual environments — Python 3.11.1 ...
On Windows, invoke the venv command as follows: ... When a Python interpreter is running from a virtual environment, sys.prefix and sys.exec_prefix point...
Read more >Settings Reference for Python - Visual Studio Code
Path to the default Python interpreter to be used by the Python extension on the first time it loads for a workspace, or...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Was just submitting a pull request with that change 😃
Was looking through the selenium v4.5.0 api trying to understand and resolve another problem but saw on this class a parameter called env which looks like a similar situation of needing to pass along env variables. I think in addition to the python interpreter I can set the env variables so that this should complete / match the operation of activating a python virtualenv.