Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
72 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,39 @@ | ||
if __name__ != '__main__': | ||
raise ImportError('This is not a module, but a script.') | ||
def main(): | ||
import sys, os, socket | ||
|
||
import sys, os, socket | ||
|
||
test_root = os.path.dirname(os.path.abspath(__file__)) | ||
os.chdir(test_root) | ||
sys.path.insert(0, os.path.dirname(test_root)) | ||
sys.path.insert(0, test_root) | ||
|
||
try: | ||
server = sys.argv[1] | ||
port = int(sys.argv[2]) | ||
|
||
if server == 'gevent': | ||
from gevent import monkey | ||
monkey.patch_all() | ||
elif server == 'eventlet': | ||
import eventlet | ||
eventlet.monkey_patch() | ||
test_root = os.path.dirname(os.path.abspath(__file__)) | ||
os.chdir(test_root) | ||
sys.path.insert(0, os.path.dirname(test_root)) | ||
sys.path.insert(0, test_root) | ||
|
||
try: | ||
import coverage | ||
coverage.process_startup() | ||
server = sys.argv[1] | ||
port = int(sys.argv[2]) | ||
|
||
if server == 'gevent': | ||
from gevent import monkey | ||
monkey.patch_all() | ||
elif server == 'eventlet': | ||
import eventlet | ||
eventlet.monkey_patch() | ||
|
||
try: | ||
import coverage | ||
coverage.process_startup() | ||
except ImportError: | ||
pass | ||
|
||
from bottle import route, run | ||
route('/test', callback=lambda: 'OK') | ||
run(port=port, server=server, quiet=True) | ||
|
||
except socket.error: | ||
sys.exit(3) | ||
except ImportError: | ||
sys.exit(128) | ||
except KeyboardInterrupt: | ||
pass | ||
|
||
from bottle import route, run | ||
route('/test', callback=lambda: 'OK') | ||
run(port=port, server=server, quiet=True) | ||
|
||
except socket.error: | ||
sys.exit(3) | ||
except ImportError: | ||
sys.exit(128) | ||
except KeyboardInterrupt: | ||
pass | ||
|
||
if __name__ == '__main__': | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters