Skip to content

Commit 3f80483

Browse files
committed
Added a non-working benchmark test
1 parent 2f9e4b0 commit 3f80483

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__)),"../"))
@@ -86,4 +86,38 @@ def test_1():
8686
assert find(lambda player: player.pid == replay.messages[11].player, replay.players).name == "Boom"
8787

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

0 commit comments

Comments
 (0)