Cleaning Up /tmp
Selenium and Xvfb tend to leave a lot of junk lying around in
/tmp
, especially when
they’re not shut down tidily (that’s why I included a
try/finally
earlier).
In fact they leave somuch stuff lying around that theymight max out your storage quota.
So do a tidy-up in
/tmp
every so often:
$
rm -rf /tmp/
*
Screenshots
In
Chapter 5 ,I suggest using a
time.sleep
to pause the FT as it runs, so that we can see
what the Selenium browser is showing on screen. We can’t do that on PythonAnywhere,
because the browser runs in a virtual display. Instead, you can inspect the live site, or
you could “take my word for it” regarding what you should see.
The best way of doing visual inspections of tests that run in a virtual display is to use
screenshots. Take a look at
Chapter 20if you’re curious—there’s some example code in
there.
The Deployment Chapter
When you hit
Chapter 8 ,you’ll have the choice of continuing to use PythonAnywhere,
or of learning how to build a “real” server. I recommend the latter, because you’ll get
the most out of it.
If you really want to stick with PythonAnywhere, one option would be deploy a second
copy of your app on a different domain. You’ll need your own domain name, and a paid
account on PythonAnywhere. But even if you don’t do that, you should still make sure
you can run the FTs in “staging”mode against the real site, rather thanusing the threaded
server from
LiveServerTestCase
.
If you are using PythonAnywhere to follow through with the book,
I’d love to hear how you get on! Do send me an email at
obeythetes tinggoat@gmail.com.
Cleaning Up /tmp
|
411