Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf2840c6

Browse files
committed
Auto-skip performance tests more quietly on travis
... and be able to run performance tests independently of the chosen performance test repoNow all tests run fine locally
1 parent342a027 commitf2840c6

File tree

7 files changed

+21
-25
lines changed

7 files changed

+21
-25
lines changed

‎.travis.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ install:
1111
-git submodule update --init --recursive
1212
-git fetch --tags
1313
-pip install coveralls
14+
1415
# for now we have to make sure there is a master branch - at some point we should just have it by default
1516
-git branch master 0.3
17+
1618
# generate some reflog as git-python tests need it
1719
-git reset --hard HEAD~1
1820
-git reset --hard HEAD~1
@@ -21,8 +23,13 @@ install:
2123
-git checkout master
2224
-git reset --hard HEAD~1
2325
-git reset --hard HEAD~1
26+
-git reset --hard HEAD~1
2427
-git reset --hard origin/0.3
2528
-git checkout 0.3
29+
30+
# as commits are performed with the default user, it needs to be set for travis too
31+
-git config --global user.email "travis@ci.com"
32+
-git config --global user.name "Travis Runner"
2633
script:
2734
-nosetests -v --with-coverage
2835
after_success:

‎git/test/lib/helper.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
importsys
99
fromgitimportRepo,Remote,GitCommandError,Git
1010
fromunittestimportTestCase
11+
importtime
1112
importtempfile
1213
importshutil
1314
importcStringIO
@@ -191,6 +192,8 @@ def remote_repo_creator(self):
191192
# On windows, this will fail ... we deal with failures anyway and default to telling the user to do it
192193
try:
193194
gd=Git().daemon(temp_dir,as_process=True)
195+
# yes, I know ... fortunately, this is always going to work if sleep time is just large enough
196+
time.sleep(0.5)
194197
exceptExceptionaserr:
195198
gd=None
196199
# end

‎git/test/performance/lib.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""Contains library functions"""
22
importos
33
fromgit.test.libimport*
4+
fromgitdb.test.libimportskip_on_travis_ci
45
importshutil
56
importtempfile
67
importlogging
@@ -36,11 +37,11 @@ class TestBigRepoR(TestBase):
3637
"""
3738

3839
#{ Invariants
39-
head_sha_2k='235d521da60e4699e5bd59ac658b5b48bd76ddca'
40-
head_sha_50='32347c375250fd470973a5d76185cac718955fd5'
4140
#} END invariants
4241

4342
defsetUp(self):
43+
# This will raise on travis, which is what we want to happen early as to prevent us to do any work
44+
skip_on_travis_ci(lambda*args:None)(self)
4445
try:
4546
super(TestBigRepoR,self).setUp()
4647
exceptAttributeError:
@@ -54,14 +55,14 @@ def setUp(self):
5455
self.gitrorepo=Repo(repo_path,odbt=GitCmdObjectDB)
5556
self.puregitrorepo=Repo(repo_path,odbt=GitDB)
5657

57-
5858
classTestBigRepoRW(TestBigRepoR):
5959

6060
"""As above, but provides a big repository that we can write to.
6161
6262
Provides ``self.gitrwrepo`` and ``self.puregitrwrepo``"""
6363

6464
defsetUp(self):
65+
self.gitrwrepo=None
6566
try:
6667
super(TestBigRepoRW,self).setUp()
6768
exceptAttributeError:
@@ -72,6 +73,7 @@ def setUp(self):
7273
self.puregitrwrepo=Repo(dirname,odbt=GitDB)
7374

7475
deftearDown(self):
75-
shutil.rmtree(self.gitrwrepo.working_dir)
76+
ifself.gitrwrepoisnotNone:
77+
shutil.rmtree(self.gitrwrepo.working_dir)
7678

7779
#} END base classes

‎git/test/performance/test_commit.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
fromgitimport*
99
fromgitdbimportIStream
1010
fromgit.test.test_commitimportassert_commit_serialization
11-
fromgitdb.test.libimportskip_on_travis_ci
1211
fromcStringIOimportStringIO
1312
fromtimeimporttime
1413
importsys
@@ -29,7 +28,6 @@ def _query_commit_info(self, c):
2928
c.message
3029
c.parents
3130

32-
@skip_on_travis_ci
3331
deftest_iteration(self):
3432
no=0
3533
nc=0
@@ -51,39 +49,36 @@ def test_iteration(self):
5149
print>>sys.stderr,"Traversed %i Trees and a total of %i unchached objects in %s [s] ( %f objs/s )"% (
5250
nc,no,elapsed_time,no/elapsed_time)
5351

54-
@skip_on_travis_ci
5552
deftest_commit_traversal(self):
5653
# bound to cat-file parsing performance
5754
nc=0
5855
st=time()
59-
forcinself.gitrorepo.commit(self.head_sha_2k).traverse(branch_first=False):
56+
forcinself.gitrorepo.commit().traverse(branch_first=False):
6057
nc+=1
6158
self._query_commit_info(c)
6259
# END for each traversed commit
6360
elapsed_time=time()-st
6461
print>>sys.stderr,"Traversed %i Commits in %s [s] ( %f commits/s )"% (nc,elapsed_time,nc/elapsed_time)
6562

66-
@skip_on_travis_ci
6763
deftest_commit_iteration(self):
6864
# bound to stream parsing performance
6965
nc=0
7066
st=time()
71-
forcinCommit.iter_items(self.gitrorepo,self.head_sha_2k):
67+
forcinCommit.iter_items(self.gitrorepo,self.gitrorepo.head):
7268
nc+=1
7369
self._query_commit_info(c)
7470
# END for each traversed commit
7571
elapsed_time=time()-st
7672
print>>sys.stderr,"Iterated %i Commits in %s [s] ( %f commits/s )"% (nc,elapsed_time,nc/elapsed_time)
7773

78-
@skip_on_travis_ci
7974
deftest_commit_serialization(self):
80-
assert_commit_serialization(self.gitrwrepo,self.head_sha_2k,True)
75+
assert_commit_serialization(self.gitrwrepo,self.gitrwrepo.head,True)
8176

8277
rwrepo=self.gitrwrepo
8378
make_object=rwrepo.odb.store
8479
# direct serialization - deserialization can be tested afterwards
8580
# serialization is probably limited on IO
86-
hc=rwrepo.commit(self.head_sha_2k)
81+
hc=rwrepo.commit(rwrepo.head)
8782

8883
nc=5000
8984
st=time()

‎git/test/performance/test_odb.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
fromtimeimporttime
44
importsys
5-
fromgitdb.test.libimportskip_on_travis_ci
65

76
fromlibimport (
87
TestBigRepoR
@@ -11,13 +10,12 @@
1110

1211
classTestObjDBPerformance(TestBigRepoR):
1312

14-
@skip_on_travis_ci
1513
deftest_random_access(self):
1614
results= [["Iterate Commits"], ["Iterate Blobs"], ["Retrieve Blob Data"]]
1715
forrepoin (self.gitrorepo,self.puregitrorepo):
1816
# GET COMMITS
1917
st=time()
20-
root_commit=repo.commit(self.head_sha_2k)
18+
root_commit=repo.commit(repo.head)
2119
commits=list(root_commit.traverse())
2220
nc=len(commits)
2321
elapsed=time()-st

‎git/test/performance/test_streams.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
fromgit.test.libimport*
44
fromgitdbimport*
55
fromgitdb.utilimportbin_to_hex
6-
fromgitdb.test.libimportskip_on_travis_ci
76

87
fromtimeimporttime
98
importos
@@ -22,7 +21,6 @@ class TestObjDBPerformance(TestBigRepoR):
2221
large_data_size_bytes=1000*1000*10# some MiB should do it
2322
moderate_data_size_bytes=1000*1000*1# just 1 MiB
2423

25-
@skip_on_travis_ci
2624
@with_rw_repo('HEAD',bare=True)
2725
deftest_large_data_streaming(self,rwrepo):
2826
# TODO: This part overlaps with the same file in gitdb.test.performance.test_stream

‎git/test/performance/test_utils.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,13 @@
22
fromtimeimporttime
33
importsys
44

5-
fromgitdb.test.libimportskip_on_travis_ci
6-
75
fromlibimport (
86
TestBigRepoR
97
)
108

119

1210
classTestUtilPerformance(TestBigRepoR):
1311

14-
@skip_on_travis_ci
1512
deftest_access(self):
1613
# compare dict vs. slot access
1714
classSlotty(object):
@@ -66,7 +63,6 @@ def __init__(self):
6663
cls.__name__,na,elapsed,na/elapsed)
6764
# END for each sequence
6865

69-
@skip_on_travis_ci
7066
deftest_instantiation(self):
7167
ni=100000
7268
max_num_items=4
@@ -109,7 +105,6 @@ def test_instantiation(self):
109105
elapsed=time()-st
110106
print>>sys.stderr,"Created %i tuples tuple((1,2,3,4)) in %f s ( %f tuples / s)"% (ni,elapsed,ni/elapsed)
111107

112-
@skip_on_travis_ci
113108
deftest_unpacking_vs_indexing(self):
114109
ni=1000000
115110
list_items= [1,2,3,4]
@@ -141,7 +136,6 @@ def test_unpacking_vs_indexing(self):
141136
ni,type(sequence).__name__,len(sequence),elapsed,ni/elapsed)
142137
# END for each sequence
143138

144-
@skip_on_travis_ci
145139
deftest_large_list_vs_iteration(self):
146140
# what costs more: alloc/realloc of lists, or the cpu strain of iterators ?
147141
defslow_iter(ni):
@@ -166,7 +160,6 @@ def slow_iter(ni):
166160
print>>sys.stderr,"Iterated %i items from iterator in %f s ( %f acc / s)"% (ni,elapsed,ni/elapsed)
167161
# END for each number of iterations
168162

169-
@skip_on_travis_ci
170163
deftest_type_vs_inst_class(self):
171164
classNewType(object):
172165
pass

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp