Skip to content

Commit 089bb83

Browse files
committed
got it working on windoze
1 parent 06cb017 commit 089bb83

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

‎v5-unity/doctest_exec.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
2525
'''
2626

27-
import cPickle
27+
import pickle
2828
import imp
2929
import json
3030
import sys
@@ -84,8 +84,8 @@ def opt_doctest_exec_script_str(script_str, custom_modules):
8484

8585
try:
8686
assert fullpath.endswith(".pickle")
87-
with open(fullpath) as f:
88-
tests = cPickle.load(f)
87+
with open(fullpath, 'rU') as f: # use 'U' to work on Windows
88+
tests = pickle.load(f)
8989

9090
found = False
9191
for t in tests:

‎v5-unity/doctest_reader.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
- a JSON blob representing its contents, printed to stdout
99
'''
1010

11-
import cPickle
11+
import pickle
1212
import sys
1313
import json
1414
import traceback
@@ -33,8 +33,8 @@ def encode_doctest(t):
3333
try:
3434
fullpath = sys.argv[1]
3535
assert fullpath.endswith(".pickle")
36-
with open(fullpath) as f:
37-
tests = cPickle.load(f)
36+
with open(fullpath, 'rU') as f: # use 'U' to work on Windows
37+
tests = pickle.load(f)
3838
all_encoded_tests = [encode_doctest(t) for t in tests]
3939
print(json.dumps(all_encoded_tests, indent=2))
4040
except:

‎v5-unity/doctest_splitter.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
objects extracted from lab1.py
1010
- the first element of this list contains the docstring for the top-level
1111
module (which you can parse to get a lab overview description); all
12-
remaining eleemnts are docstrings for functions
12+
remaining elements are docstrings for functions
1313
1414
'''
1515

16-
import cPickle
16+
import pickle
1717
import doctest
1818
import os
1919
import sys
@@ -58,5 +58,5 @@
5858
f.write(stripped_filestr)
5959
print "Created", bn + '_skeleton.py'
6060
with open(bn + '_doctests.pickle', 'w') as f:
61-
cPickle.dump(tests, f, protocol=2)
61+
pickle.dump(tests, f, protocol=0) # use protocol=0 to work on Windows
6262
print "Created", bn + '_doctests.pickle'

0 commit comments

Comments
 (0)