3

I want to run Python code coverage tests for Google App Engine in Eclipse or from command line.

Normally Python program required such command line:

coverage run program arguments

I trying to run it for Google App Engine but no data is collected from following command line:

coverage run [path_to_google_app_engine]/dev_appserver.py [application_options] application_root

It not produce .coverage after terminating server - do you have any idea what is wrong? How to stop server and get .coverage data?

Chameleon
  • 9,722
  • 16
  • 65
  • 127

1 Answers1

2

I don't know much about GAE, but I know a lot about coverage.py. If the dev_appserver.py command runs the server in the same process, then the command you have should work. If the server actually runs in a subprocess, then see Measuring subprocesses in the coverage.py docs for how to get subprocesses measured.

Ned Batchelder
  • 364,293
  • 75
  • 561
  • 662
  • Not sure on 95% but it looks that dev_appserver.py not spawn processes but runs http server forever and wait for KeyboardInterrupt. If coverage.py is saving results after KeyboardInterrupt it should works - do you know what will do coverage.py on KeyboardInterrupt? The other problem could be that GAE block file write and results should be redirected to memory streams and save in database or presented on page - is it possible to redirect such output in coverage without patching? – Chameleon Apr 29 '11 at 07:43
  • This doesn't work on current versions of GAE. They do some sandboxing within the code run for GAE (eg disable loading of binary modules, remove modules and methods not supported on the servers). coverage now produces data for everything **except** the actual application code! http://stackoverflow.com/questions/16785929/ – Roger Binns May 30 '13 at 06:06