Commits

remosu committed f73f491

start/stop bacmongo test server from make

Comments (0)

Files changed (4)

 test-acceptance:
+	./test/acceptance/backmongo_server_setup.py
 	./test/acceptance/mongodb_setup.py
 	mocha --reporter spec \
 	 test/acceptance/*.js
 
+start-test-server:
+	./test/acceptance/backmongo_server_setup.py
+
+stop-test-server:
+	kill `cat /tmp/backmongo-test-server.pid`
+	rm /tmp/backmongo-test-server.pid
+
 .PHONY: test
 
 import flask_backmongo
 
+import os
+print os.getpid()
+
 flask_backmongo.main()
+

flask_backmongo.py

             static_url_path='/static',
             static_folder=static_folder)
     init_app(app)
-    app.run(debug=True)
+    app.run(debug=False)
 
 if __name__ == '__main__':
     main()

test/acceptance/backmongo_server_setup.py

+#! /usr/bin/env python
+
+import os
+import subprocess
+
+pidfile = '/tmp/backmongo-test-server.pid'
+
+if not os.path.isfile(pidfile):
+    pid = subprocess.Popen('./bin/backmongo').pid
+    open(pidfile, 'w').write(str(pid))
+    print "1>", pid