Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Adding Travis integration

Updating information on blog post

Changing all format strings to be python 2.6 compatible

Adding travis CI build status
  • Loading branch information...
commit c83f1b8364b5ec3d37676d7d2f50d493e6fac839 1 parent b4f93cd
Kelvin Law authored
8  .travis.yml
... ...
@@ -0,0 +1,8 @@
  1
+language: python
  2
+python:
  3
+  - "2.6"
  4
+  - "2.7"
  5
+# command to install dependencies
  6
+install: "pip install . --use-mirrors"
  7
+# command to run tests
  8
+script: "nosetests tests/unit/"
5  README.md
Source Rendered
@@ -11,7 +11,7 @@ Shadow comes with a UI that allows users to monitor the stream of requests live.
11 11
 
12 12
 All request and responses are also logged in as a JSON (Default: log/shadow-results.log) for easy parsing and analysis.
13 13
 
14  
-For more information, check out our blog post on Shadow. 
  14
+For more information, check out our blog post on Shadow in the coming week. 
15 15
 
16 16
 ## Installing
17 17
 
@@ -90,6 +90,9 @@ Tests are in the `tests` directory.  Run them using nose
90 90
 
91 91
     nosetests tests/
92 92
 
  93
+##Build Status
  94
+[![Build Status](https://secure.travis-ci.org/twilio/shadow.png)](http://travis-ci.org/twilio/shadow)
  95
+
93 96
 
94 97
 ## Based upon
95 98
 
2  debug_shadow.conf.py
@@ -57,7 +57,7 @@
57 57
             'results': {
58 58
                 'class': 'logging.FileHandler',
59 59
                 'formatter': 'default_pywsgi_access_fix',
60  
-                "filename": os.path.join(file_prefix, "{}-results.log".format(program_name))
  60
+                "filename": os.path.join(file_prefix, "{program_name!r}-results.log".format(program_name=program_name))
61 61
             }
62 62
         },
63 63
         'loggers': {
6  shadow.conf.py
@@ -57,17 +57,17 @@
57 57
             'ui': {
58 58
                 'class': 'logging.FileHandler',
59 59
                 'formatter': 'default',
60  
-                "filename": os.path.join(file_prefix, "{}-ui.log".format(program_name))
  60
+                "filename": os.path.join(file_prefix, "{program_name!r}-ui.log".format(program_name=program_name))
61 61
             },
62 62
             'proxy': {
63 63
                 'class': 'logging.FileHandler',
64 64
                 'formatter': 'default',
65  
-                "filename": os.path.join(file_prefix, "{}-proxy.log".format(program_name))
  65
+                "filename": os.path.join(file_prefix, "{program_name!r}-proxy.log".format(program_name=program_name))
66 66
             },
67 67
             'results': {
68 68
                 'class': 'logging.FileHandler',
69 69
                 'formatter': 'default_pywsgi_access_fix',
70  
-                "filename": os.path.join(file_prefix, "{}-results.log".format(program_name))
  70
+                "filename": os.path.join(file_prefix, "{program_name!r}-results.log".format(program_name=program_name))
71 71
             }
72 72
         },
73 73
         'loggers': {
12  src/shadow/proxy/web.py
@@ -36,13 +36,13 @@ def __init__(self, service,
36 36
         super(ProxyFlask, self).__init__(__name__)
37 37
 
38 38
         if len(old_servers) == 0:
39  
-            raise ProxyConfigError("At least 1 old server must be specified, old servers: {}". format(old_servers))
  39
+            raise ProxyConfigError("At least 1 old server must be specified, old servers: {old_servers!r}". format(old_servers=old_servers))
40 40
 
41 41
         if len(new_servers) == 0:
42  
-            raise ProxyConfigError("At least 1 new server mush be specified, new server: {}".format(new_servers))
  42
+            raise ProxyConfigError("At least 1 new server mush be specified, new server: {new_servers!r}".format(new_servers=new_servers))
43 43
 
44 44
         if not all([isinstance(x, AbstractResultsLogger) for x in result_loggers]):
45  
-            raise ProxyConfigError("result_loggers must all be sub-classes of AbstractResultsLogger: {}".format(result_loggers))
  45
+            raise ProxyConfigError("result_loggers must all be sub-classes of AbstractResultsLogger: {result_loggers!r}".format(result_loggers=result_loggers))
46 46
 
47 47
         self.old_servers = old_servers
48 48
         self.new_servers = new_servers
@@ -69,12 +69,12 @@ def __init__(self, service,
69 69
             })
70 70
 
71 71
     def log_result(self, result):
72  
-        logger.debug('Logging results: {}'.format(result))
  72
+        logger.debug('Logging results: {result!r}'.format(result=result))
73 73
         for results_log in self.result_loggers:
74 74
             try:
75 75
                 results_log.log_result(result)
76 76
             except Exception:
77  
-                logger.exception("Results Logger: {} encountered exception logging result: {}".format(results_log, result))
  77
+                logger.exception("Results Logger: {results_log!r} encountered exception logging result: {result!r}".format(results_log=results_log, result=result))
78 78
 
79 79
     def format_response(self, response, elapsed_time=None):
80 80
         resp = None
@@ -138,7 +138,7 @@ def timer(self, timed_func, *args, **kwargs):
138 138
             logger.exception("Exception encountered in time step")
139 139
             result = e
140 140
         elapsed = time.time() - start
141  
-        logger.info("Timed request [{}] with args {}, {}".format(elapsed, args, kwargs))
  141
+        logger.info("Timed request [{elapsed!r}] with args {args!r}, {kwargs!r}".format(elapsed=elapsed, args=args, kwargs=kwargs))
142 142
         return (result, elapsed)
143 143
 
144 144
     def catch_all(self, path):
2  src/shadow/services/proxy.py
@@ -28,7 +28,7 @@ class ProxyService(Service):
28 28
     new_servers_additional_get_params = settings.get('proxy', {}).get('new_servers_additional_get_params', [])
29 29
 
30 30
     def do_start(self):
31  
-        logger.info("Starting ProxyService on {}:{}".format(self.address, self.port))
  31
+        logger.info("Starting ProxyService on {address!r}:{port!r}".format(address=self.address, port=self.port))
32 32
 
33 33
     def do_stop(self):
34 34
         logger.info("Stopping ProxyService")
4  src/shadow/services/ui.py
@@ -17,7 +17,7 @@ class UIService(Service):
17 17
     port = settings.get('ui', {}).get('port', 9000)
18 18
 
19 19
     def broadcast_message(self, event, args, ns_name=''):
20  
-        logger.debug("Broadcasting Event: {} Data: {}".format(event, args))
  20
+        logger.debug("Broadcasting Event: {event!r} Data: {args!r}".format(event=event, args=args))
21 21
         try:
22 22
             socket_server = self.server
23 23
         except Exception:
@@ -30,7 +30,7 @@ def broadcast_message(self, event, args, ns_name=''):
30 30
             socket.send_packet(pkt)
31 31
 
32 32
     def do_start(self):
33  
-        logger.info("Starting UIService on {}:{}".format(self.address, self.port))
  33
+        logger.info("Starting UIService on {address!r}:{port!r}".format(address=self.address, port=self.port))
34 34
 
35 35
     def do_stop(self):
36 36
         logger.info("Stopping UIService")

0 notes on commit c83f1b8

Please sign in to comment.
Something went wrong with that request. Please try again.