Python 3, an illustrated tour Transcripts
Chapter: Virtual Environments
Lecture: Walk-through: Virtual Environments and Pip (PyCharm)
0:00 In this video I'm going to show how to use PyCharm to run the venv test file.
0:03 I'm going to use the environment that we created using pipenv.
0:07 So I'm going to say create new project, it's going to be a pure Python project
0:10 and it's going to point to the labs folder where I have the labs
0:14 and note I'm going to say use an existing interpreter.
0:17 PyCharm will happily create a new virtual environment for us
0:21 if we want to, but we're going to use an existing one,
0:24 so we have to click the little gear here and say add local
0:26 and let's make sure that we use the right one.
0:30 So I'm going to go into my home directory
0:33 and I'm going to go to my .local and in my shared directory there is labs
0:39 and note that it's looking for the Python executable there
0:44 so I need to come down here and click on Python right here.
0:47 Okay, at this point, I'll hit create and it will say the directory labs is not empty,
0:53 would you like to create a project from existing sources?
0:55 Yes, let's do that.
0:59 Great. Here's the file right here.
1:01 Let's run this and see if it runs.
1:04 So to run it, it's going to index, we'll let it index for a while.
1:10 Okay, now let's run this here.
1:12 So I'm going to say run venv test, and it looks like it ran,
1:17 note that it said it used the virtual environment Python to run it and it ran it
1:22 and the test imports pytest so it looks like pytest is working.
1:27 This video showed how to use PyCharm to create a new project
1:31 using an existing pipenv environment and to run a test,
1:35 note that I can also right click here and say run test again and it will run it again.