Skip to content

Commit fd2eba4

Browse files
authored
Merge pull request #33 from ankostis/appveyor
Enable Appveyor CI for Windows, 3 win-errors on all PY-vers _ One set of errors already fixed: div-by-zero on elapsed times - Appveyor must be quick.
2 parents 38866bc + d48679a commit fd2eba4

File tree

6 files changed

+70
-19
lines changed

6 files changed

+70
-19
lines changed

Diff for: .appveyor.yml

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# CI on Windows via appveyor
2+
environment:
3+
4+
matrix:
5+
## MINGW
6+
#
7+
- PYTHON: "C:\\Python27"
8+
PYTHON_VERSION: "2.7"
9+
- PYTHON: "C:\\Python34-x64"
10+
PYTHON_VERSION: "3.4"
11+
- PYTHON: "C:\\Python35-x64"
12+
PYTHON_VERSION: "3.5"
13+
- PYTHON: "C:\\Miniconda35-x64"
14+
PYTHON_VERSION: "3.5"
15+
IS_CONDA: "yes"
16+
17+
install:
18+
- set PATH=%PYTHON%;%PYTHON%\Scripts;%PATH%
19+
20+
## Print configuration for debugging.
21+
#
22+
- |
23+
echo %PATH%
24+
uname -a
25+
where python pip pip2 pip3 pip34
26+
python --version
27+
python -c "import struct; print(struct.calcsize('P') * 8)"
28+
29+
- IF "%IS_CONDA%"=="yes" (
30+
conda info -a &
31+
conda install --yes --quiet pip
32+
)
33+
- pip install nose wheel coveralls
34+
35+
## For commits performed with the default user.
36+
- |
37+
git config --global user.email "[email protected]"
38+
git config --global user.name "Travis Runner"
39+
40+
- pip install -e .
41+
42+
build: false
43+
44+
test_script:
45+
- IF "%PYTHON_VERSION%"=="3.5" (
46+
nosetests -v --with-coverage
47+
) ELSE (
48+
nosetests -v
49+
)

Diff for: README.rst

+4-5
Original file line numberDiff line numberDiff line change
@@ -43,22 +43,21 @@ Once the clone is complete, please be sure to initialize the submodules using
4343
cd gitdb
4444
git submodule update --init
4545

46-
Run the tests with
47-
46+
Run the tests with
47+
4848
nosetests
4949

5050
DEVELOPMENT
5151
===========
5252

5353
.. image:: https://travis-ci.org/gitpython-developers/gitdb.svg?branch=master
5454
:target: https://travis-ci.org/gitpython-developers/gitdb
55-
55+
.. image:: https://ci.appveyor.com/api/projects/status/2qa4km4ln7bfv76r/branch/master?svg=true&passingText=windows%20OK&failingText=windows%20failed
56+
:target: https://ci.appveyor.com/project/ankostis/gitpython/branch/master)
5657
.. image:: https://coveralls.io/repos/gitpython-developers/gitdb/badge.png
5758
:target: https://coveralls.io/r/gitpython-developers/gitdb
58-
5959
.. image:: http://www.issuestats.com/github/gitpython-developers/gitdb/badge/pr
6060
:target: http://www.issuestats.com/github/gitpython-developers/gitdb
61-
6261
.. image:: http://www.issuestats.com/github/gitpython-developers/gitdb/badge/issue
6362
:target: http://www.issuestats.com/github/gitpython-developers/gitdb
6463

Diff for: gitdb/test/performance/test_pack.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def test_pack_random_access(self):
3636
sha_list = list(pdb.sha_iter())
3737
elapsed = time() - st
3838
ns = len(sha_list)
39-
print("PDB: looked up %i shas by index in %f s ( %f shas/s )" % (ns, elapsed, ns / elapsed), file=sys.stderr)
39+
print("PDB: looked up %i shas by index in %f s ( %f shas/s )" % (ns, elapsed, ns / (elapsed or 1)), file=sys.stderr)
4040

4141
# sha lookup: best-case and worst case access
4242
pdb_pack_info = pdb._pack_info
@@ -51,7 +51,7 @@ def test_pack_random_access(self):
5151
del(pdb._entities)
5252
pdb.entities()
5353
print("PDB: looked up %i sha in %i packs in %f s ( %f shas/s )" %
54-
(ns, len(pdb.entities()), elapsed, ns / elapsed), file=sys.stderr)
54+
(ns, len(pdb.entities()), elapsed, ns / (elapsed or 1)), file=sys.stderr)
5555
# END for each random mode
5656

5757
# query info and streams only
@@ -62,7 +62,7 @@ def test_pack_random_access(self):
6262
pdb_fun(sha)
6363
elapsed = time() - st
6464
print("PDB: Obtained %i object %s by sha in %f s ( %f items/s )" %
65-
(max_items, pdb_fun.__name__.upper(), elapsed, max_items / elapsed), file=sys.stderr)
65+
(max_items, pdb_fun.__name__.upper(), elapsed, max_items / (elapsed or 1)), file=sys.stderr)
6666
# END for each function
6767

6868
# retrieve stream and read all
@@ -78,7 +78,7 @@ def test_pack_random_access(self):
7878
elapsed = time() - st
7979
total_kib = total_size / 1000
8080
print("PDB: Obtained %i streams by sha and read all bytes totallying %i KiB ( %f KiB / s ) in %f s ( %f streams/s )" %
81-
(max_items, total_kib, total_kib / elapsed, elapsed, max_items / elapsed), file=sys.stderr)
81+
(max_items, total_kib, total_kib / (elapsed or 1), elapsed, max_items / (elapsed or 1)), file=sys.stderr)
8282

8383
@skip_on_travis_ci
8484
def test_loose_correctness(self):
@@ -129,5 +129,5 @@ def test_correctness(self):
129129
# END for each entity
130130
elapsed = time() - st
131131
print("PDB: verified %i objects (crc=%i) in %f s ( %f objects/s )" %
132-
(count, crc, elapsed, count / elapsed), file=sys.stderr)
132+
(count, crc, elapsed, count / (elapsed or 1)), file=sys.stderr)
133133
# END for each verify mode

Diff for: gitdb/test/performance/test_pack_streaming.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,14 @@ def test_pack_writing(self):
5252
# END gather objects for pack-writing
5353
elapsed = time() - st
5454
print("PDB Streaming: Got %i streams by sha in in %f s ( %f streams/s )" %
55-
(ni, elapsed, ni / elapsed), file=sys.stderr)
55+
(ni, elapsed, ni / (elapsed or 1)), file=sys.stderr)
5656

5757
st = time()
5858
PackEntity.write_pack((pdb.stream(sha) for sha in pdb.sha_iter()), ostream.write, object_count=ni)
5959
elapsed = time() - st
6060
total_kb = ostream.bytes_written() / 1000
6161
print(sys.stderr, "PDB Streaming: Wrote pack of size %i kb in %f s (%f kb/s)" %
62-
(total_kb, elapsed, total_kb / elapsed), sys.stderr)
62+
(total_kb, elapsed, total_kb / (elapsed or 1)), sys.stderr)
6363

6464
@skip_on_travis_ci
6565
def test_stream_reading(self):
@@ -82,4 +82,4 @@ def test_stream_reading(self):
8282
elapsed = time() - st
8383
total_kib = total_size / 1000
8484
print(sys.stderr, "PDB Streaming: Got %i streams by sha and read all bytes totallying %i KiB ( %f KiB / s ) in %f s ( %f streams/s )" %
85-
(ni, total_kib, total_kib / elapsed, elapsed, ni / elapsed), sys.stderr)
85+
(ni, total_kib, total_kib / (elapsed or 1), elapsed, ni / (elapsed or 1)), sys.stderr)

Diff for: gitdb/test/performance/test_stream.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def test_large_data_streaming(self, path):
7070

7171
size_kib = size / 1000
7272
print("Added %i KiB (filesize = %i KiB) of %s data to loose odb in %f s ( %f Write KiB / s)" %
73-
(size_kib, fsize_kib, desc, elapsed_add, size_kib / elapsed_add), file=sys.stderr)
73+
(size_kib, fsize_kib, desc, elapsed_add, size_kib / (elapsed_add or 1)), file=sys.stderr)
7474

7575
# reading all at once
7676
st = time()
@@ -81,7 +81,7 @@ def test_large_data_streaming(self, path):
8181
stream.seek(0)
8282
assert shadata == stream.getvalue()
8383
print("Read %i KiB of %s data at once from loose odb in %f s ( %f Read KiB / s)" %
84-
(size_kib, desc, elapsed_readall, size_kib / elapsed_readall), file=sys.stderr)
84+
(size_kib, desc, elapsed_readall, size_kib / (elapsed_readall or 1)), file=sys.stderr)
8585

8686
# reading in chunks of 1 MiB
8787
cs = 512 * 1000
@@ -101,7 +101,7 @@ def test_large_data_streaming(self, path):
101101

102102
cs_kib = cs / 1000
103103
print("Read %i KiB of %s data in %i KiB chunks from loose odb in %f s ( %f Read KiB / s)" %
104-
(size_kib, desc, cs_kib, elapsed_readchunks, size_kib / elapsed_readchunks), file=sys.stderr)
104+
(size_kib, desc, cs_kib, elapsed_readchunks, size_kib / (elapsed_readchunks or 1)), file=sys.stderr)
105105

106106
# del db file so we keep something to do
107107
os.remove(db_file)

Diff for: gitdb/test/test_pack.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -188,15 +188,18 @@ def test_pack_entity(self, rw_dir):
188188

189189
# pack writing - write all packs into one
190190
# index path can be None
191-
pack_path = tempfile.mktemp('', "pack", rw_dir)
191+
pack_path1 = tempfile.mktemp('', "pack1", rw_dir)
192+
pack_path2 = tempfile.mktemp('', "pack2", rw_dir)
192193
index_path = tempfile.mktemp('', 'index', rw_dir)
193194
iteration = 0
194195

195196
def rewind_streams():
196197
for obj in pack_objs:
197198
obj.stream.seek(0)
198199
# END utility
199-
for ppath, ipath, num_obj in zip((pack_path, ) * 2, (index_path, None), (len(pack_objs), None)):
200+
for ppath, ipath, num_obj in zip((pack_path1, pack_path2),
201+
(index_path, None),
202+
(len(pack_objs), None)):
200203
iwrite = None
201204
if ipath:
202205
ifile = open(ipath, 'wb')
@@ -214,7 +217,7 @@ def rewind_streams():
214217
assert os.path.getsize(ppath) > 100
215218

216219
# verify pack
217-
pf = PackFile(ppath)
220+
pf = PackFile(ppath) # FIXME: Leaks file-pointer(s)!
218221
assert pf.size() == len(pack_objs)
219222
assert pf.version() == PackFile.pack_version_default
220223
assert pf.checksum() == pack_sha

0 commit comments

Comments
 (0)