Ask Your Question
1

activate virtualenv in test script

asked 2022-08-05 16:49:33 -0500

piscvau's avatar

In a project with no virtualenv activated I am testing python script to activate virtual env. Creation and activation are done using subprocess to call bash scripts.

I cannot get the virtual env to be activated, that is the VIRTUAL_ENV environment variable to be set. Is this deviant usage of wing?

I guess I can find a turn around with mocks. I would just like to know!...

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-08-05 18:40:24 -0500

updated 2022-08-05 18:41:24 -0500

In general the way to activate a virtualenv for a debug or test process, or for the Python Shell, is to set the Python Executable to Activated Env and specify the full path to the activation script. This can either be in Project Properties under the Environment tab or in a Launch Configuration created from the Project menu.

If your tests use a different env than your project in general, you would need to create a launch configuration and either use it in the Environment in the Testing tab of Project Properties (for all tests) or in the File Properties on a specific test file (if just one test file is using that env).

Some relevant docs:

Please don't hesitate to ask if this isn't clear.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2022-08-05 16:49:33 -0500

Seen: 6,518 times

Last updated: Aug 16 '22