#100DaysOfWeb in Python Transcripts
Chapter: Days 81-84: Unit testing web apps
Lecture: Setting up the app to be tested

Login or purchase this course to watch this video and the rest of the course contents.
0:00 All right, it's time to start writing some code. So, what app are we going to work with? Well, of course, one that we've already been working with.
0:08 Here we are in our 81 to 84 unit testing chapter and you can see, there's nothing. So, what we want to do is take our demo code
0:15 from our migrations chapter, that's our bill tracker app. We want to use it here. Now of course, copying this over does not work well
0:22 with the virtual environment and the egg and things like that, the package registrations. So, let's go over here and start this from scratch.
0:29 Once again, I will create a virtual environment and then we can go and open this in PyCharm. Now, it looks scary 'cause everything is red
0:38 but that just means it's not yet committed but it already has the runner and it looks like it's already configured.
0:43 Let's just see that this runs, one more time. Oh, of course, we have to install our project, make sure
0:49 it's using the virtual environment that we created. It looks like it's on the wrong one, super let's fix that real quick.
0:59 Here we go, we have our local one from the unit testing one we've just created. Now, let's go ahead and set up our project
1:05 so we'll say Python setup.py develop. We also have our requirements that we need to deal with.
1:15 Super, okay so it looks like everything is ready to roll. Alright, let's go ahead and run it and there we have it, our app is working once again.
1:25 So, you can tell, obviously from this we using Pyramid to write these tests, but the idea is very very similar
1:31 for Django, it's very very similar for Flask. So we got to pick one of web frameworks we're going to use this one that we've been building up
1:38 over time, but the ideas you learn here obviously apply to all the frameworks. Okay, our app is up and running. Next thing to do, actually
1:45 is to do a little bit of reorganization so it's easier to write and control and manage these tests.


Talk Python's Mastodon Michael Kennedy's Mastodon