def test_chop(self): match = 'hello world' s = 'hello world\n' self.assertEquals(chop(s), match) s = 'hello world\r' self.assertEquals(chop(s), match) s = 'hello world\r\n' self.assertEquals(chop(s), match) s = 'hello world\n\r' self.assertEquals(chop(s), match) s = 'hello world\r*' self.assertEquals(chop(s,extras='*'), match)
def main(): """ Steps to start: 1. Obtain host, port from args 2. Obtain token from stdin 3. Call in and get service name, logdir (if any), launchTime etc 4. Startup """ host, port = sys.argv[1:3] port=int(port) token = chop(sys.stdin.readline()) worker = PelotonWorker(host, port, token) return worker.start()