Skip to content

Commit af64dc0

Browse files
committed
Merge branch 'alexhanh'
2 parents 9ffe736 + 3f80483 commit af64dc0

File tree

1 file changed

+38
-4
lines changed

1 file changed

+38
-4
lines changed

test_replays/test_all.py

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
# Note: Chose pytest over unittest(2) because of cleaner and more lightweight syntax.
2-
# Run tests with "py.test"
1+
# Run tests with "py.test" in the project root dir
32

43
# TODO:
54
# - Performance tests to measure the effect of optimizations
6-
import os,sys
5+
import os, sys
6+
from timeit import Timer
77
import pytest
88

99
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)),"../"))
@@ -96,4 +96,38 @@ def test_1():
9696
assert replay.messages[11].player.name == "Boom"
9797

9898
for msg in replay.messages:
99-
assert sent_to_all(msg) == True
99+
assert sent_to_all(msg) == True
100+
101+
# Uncathegorized tests
102+
103+
def proxy():
104+
file_list = []
105+
rootdir = "test_replays/"
106+
for root, sub_folders, files in os.walk(rootdir):
107+
for file in files:
108+
if (os.path.splitext(file)[1].lower() == ".sc2replay"):
109+
file_list.append(os.path.join(root,file))
110+
111+
for file in file_list:
112+
try:
113+
replay = Replay(file)
114+
except ValueError as e:
115+
print e
116+
except ParseError as e:
117+
print e
118+
119+
# Is there a way to print things out when a test passes? pytest seems to ignore
120+
# Stdout when tests are passing.
121+
122+
# Do we need to use a proxy function to use timeit? Also, timeit doesn't seem to
123+
# find proxy() for some reason.
124+
125+
# timeit over other python time functions, because it should provide more consistent results
126+
# across different platforms.
127+
# http://docs.python.org/library/timeit.html
128+
def test_performace():
129+
130+
t = Timer("proxy()")
131+
print t.timeit()
132+
133+
assert 1 == 0

0 commit comments

Comments
 (0)