-
Notifications
You must be signed in to change notification settings - Fork 191
/
Copy pathnoxfile.py
62 lines (53 loc) · 1.74 KB
/
noxfile.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import csv
import time
import nox
# pymunks = [
# ('4.0.0', ['2.7']),
# ('5.4.1', ['2.7','3.9']),
# ('5.5.0', ['2.7','3.9']),
# ('5.6.0', ['2.7','3.9']),
# ('6.0.0', ['3.9']),
# ('6.1.0', ['3.9']),
# ('6.2.0', ['3.9']),
# ('6.3.0', ['3.9','3.11']),
# ('6.4.0', ['3.9','3.11','pypy3.9']),
# ]
pymunks = [
('5.4.1', ['3.9']),
('5.5.0', ['3.9']),
('5.6.0', ['3.9']),
('6.0.0', ['3.9']),
('6.1.0', ['3.9']),
('6.2.0', ['3.9']),
('6.3.0', ['3.9']),
('6.4.0', ['3.9']),
]
tests = [
"pymunk-get.py",
"pymunk-callback.py",
"pymunk-collision-callback.py"
]
params = []
for (pymunk, pythons) in pymunks:
for test in tests:
params.extend( [(python, pymunk, test) for python in pythons])
# docker run --rm -it -v $(pwd):/src thekevjames/nox:latest nox -f src/noxfile.py
# docker run --rm -it -v $(pwd):/src viblo/pymunk-bench:2022.12.01 nox -f src/noxfile.py
result_file = f'results/results-{time.strftime("%Y%m%d-%H%M%S")}.csv'
with open(result_file, 'w', newline='') as csvfile:
w = csv.writer(csvfile, dialect='unix')
w.writerow(['Python', 'Pymunk Version', 'Test', 'Runtime (s)'])
def write_result(r):
with open(result_file, 'a', newline='') as csvfile:
w = csv.writer(csvfile, dialect='unix')
w.writerow(r)
@nox.session
@nox.parametrize('python,pymunk,test', params)
def get(session, pymunk,test):
session.install(f"pymunk=={pymunk}")
out = session.run("python", test, silent=True)
running_time_s = out.split('\n')[-2]
session.log(running_time_s)
print(running_time_s)
print(f"python {session.python} pymunk {pymunk} test {test} {float(running_time_s):.2f}")
write_result([session.python, pymunk, test, round(float(running_time_s),2)])