From 3fc543cb7f2963a2399e9ab6a093613b89b42562 Mon Sep 17 00:00:00 2001 From: clowwindy Date: Fri, 31 Oct 2014 14:49:35 +0800 Subject: [PATCH] add unit test for lru cache --- .travis.yml | 3 ++- tests/test_latency.py | 11 ++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index e36c6411d..46419ea18 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,10 +9,11 @@ cache: before_install: - sudo apt-get update -qq - sudo apt-get install -qq build-essential libssl-dev swig python-m2crypto python-numpy dnsutils - - pip install m2crypto salsa20 pep8 + - pip install m2crypto salsa20 pep8 nose - sudo tests/socksify/install.sh script: - pep8 . + - nosetests shadowsocks/* - python tests/test.py -c tests/table.json - python tests/test.py -c tests/aes.json - python tests/test.py -c tests/aes-ctr.json diff --git a/tests/test_latency.py b/tests/test_latency.py index 26df54232..5d44644d7 100644 --- a/tests/test_latency.py +++ b/tests/test_latency.py @@ -4,9 +4,10 @@ import time -before = time.time() +if __name__ == '__main__': + before = time.time() -for line in sys.stdin: - if 'HTTP/1.1 ' in line: - diff = time.time() - before - print 'headline %dms' % (diff * 1000) + for line in sys.stdin: + if 'HTTP/1.1 ' in line: + diff = time.time() - before + print 'headline %dms' % (diff * 1000)