Hi Robert,
Thanks for your reply, I’m glad to see you are still monitoring the
list and I am surprised there isn’t more community activity around
your tools!
The problem isn’t with with dev_appserver, it is more with gaedriver.
I’m using a simplified version of the aeta run_tests.py code to run
tests for my app with gaedriver to launch the app. Just as in the aeta
code, aeta is the test runner.
e.g.
E2E_HOSTNAME = 'localhost:8087'
def run_tests(sdk_dir):
config = gaedriver.Config(app_id=‘myapp-e2e-test',
app_dir='.',
cluster_hostname=E2E_HOSTNAME,
sdk_dir=sdk_dir)
app_token = gaedriver.setup_app(config)
aeta_url = 'http://%s/tests' % config.app_hostname
local_client.main(aeta_url)
gaedriver.teardown_app(config,app_token)
def main():
sdk_dir = os.getenv('GAE_SDK_DIR')
run_tests(sdk_dir)
if __name__ == '__main__':
main()
When this code is run python complains that the application server
isn’t running.
File "/Users/frank/Sources/myapp/aeta/local_client.py", line 292, in urlopen
return self._opener.open(url, data)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py",
line 404, in open
response = self._open(req, data)
… abridged …
return self.do_open(httplib.HTTPConnection, req)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py",
line 1184, in do_open
raise URLError(err)
urllib2.URLError: <urlopen error [Errno 61] Connection refused>
This is because gaedriver is invoking dev_appserver without a boolean
argument for —clear_datastore:
e.g. dev_appserver.py --clear_datastore .
which results in:
ValueError: '.' unrecognized boolean; known booleans are 'true',
'yes', '1', 'false', 'no', '0'
The invocation should be:
dev_appserver.py --clear_datastore true .
Where dev_appserver continues normally with the behaviour you described.
I assume this happened because dev_appserver’s command line interface
has changed since gaedriver was written.
To be clear I am using version 1.9.17 of the SDK according to my VERSION file.
Subsequent to this issue I also had another problem with gaedriver
where the above code would hang around the time that main() should
exit. This appears to be because the call to os.kill() the
devappserver subprocess is not successful. I resolved this by using
os.killpg() instead.
--- a/py/src/gaedriver/gaedriver.py
+++ b/py/src/gaedriver/gaedriver.py
@@ -407,14 +407,15 @@
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
- env=_get_env_vars())
+ env=_get_env_vars(),
+ preexec_fn=os.setsid)
self.pid_ = popen.pid
(self.stdout_, self.stderr_) = popen.communicate(self.stdin)
self.returncode_ = popen.returncode
def stop(self):
if self.pid_:
- os.kill(self.pid, signal.SIGKILL)
+ os.killpg(self.pid, signal.SIGTERM)
class AppcfgThread(ClientThreadBase_):
(I also used SIGTERM instead because SIGKILL is more abrupt than
strictly necessary, but maybe there is a case for using SIGKILL as a
fallback. In any case it is probably not essential to fix the issue.)
I don’t intend to overload you with inline patches like this! When I
posted yesterday I wasn’t very hopeful of a reply, but knowing there
might be someone to work with would obviously encourage me to make the
effort to learn to follow what ever is the normal process for
contributions is. I’m not very familiar with mercurial, it seems there
are multiple ways to create branches in mercurial and I am not sure
what is the normal way.
I’ve created a couple entries on google code to track these issues:
https://code.google.com/p/gaedriver/issues/detail?id=3
https://code.google.com/p/gaedriver/issues/detail?id=4
Thanks,
Frank