Skip to content
This repository has been archived by the owner on Jul 21, 2022. It is now read-only.

Commit

Permalink
Merge pull request #51 from iblancasa/testing
Browse files Browse the repository at this point in the history
Solving problems with coverage
  • Loading branch information
iblancasa committed Dec 20, 2015
2 parents f1fd485 + 4c0b015 commit c393901
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ install:
- pip install -r requirements.txt
- pip install coveralls
script:
- nosetests --with-coverage --cover-package=GitHubCity --cover-package=GitHubUser testGitHubCity.py testGitHubUser.py -v
- nosetests --with-coverage --cover-package=GitHubCity --cover-package=GitHubUser testGitHubUser.py testGitHubCity.py -v
after_success:
- coveralls
27 changes: 13 additions & 14 deletions testGitHubCity.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,17 +138,6 @@ def test_readAPI():
ok_("items" in data, "Items are not correct")


def test_getBestIntervals():
"""Get best intervals to query"""

cityB = GitHubCity("Barcelona", idGH, secretGH)
cityB.calculateBestIntervals()

for i in cityB._intervals:
ok_(i[0]!="" and i[0]!=None, "First part of interval is not correct")
ok_(i[1]!="" and i[0]!=None, "First part of interval is not correct")


def test_addUser():
"""Add new users to the list"""
global cityA
Expand All @@ -162,14 +151,24 @@ def test_addUser():
eq_(len(cityA._dataUsers), 1, "User was added two times to the dataUsers list")


def test_getBestIntervals():
"""Get best intervals to query"""
global cityA
cityA = GitHubCity("Barcelona", idGH, secretGH, debug=True)
cityA.calculateBestIntervals()

for i in cityA._intervals:
ok_(i[0]!="" and i[0]!=None, "First part of interval is not correct")
ok_(i[1]!="" and i[0]!=None, "First part of interval is not correct")



def test_getAllUsers():
"""Get all users from a city
"""
global idGH, secretGH, cityA
cityA = GitHubCity("Granada", idGH, secretGH,debug=False)
cityA.calculateBestIntervals()
global cityA
cityA.getCityUsers()
ok_(len(cityA._myusers)>=len(cityA._dataUsers),"Get all users is not ok")


def test_excludeUsers():
Expand Down
5 changes: 4 additions & 1 deletion testGitHubUser.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,15 @@ def testNoUser():
falseUser = GitHubUser("shurmanicop")
assert_raises(Exception,falseUser.getData())

'''
#This test is deactivated to improve perfomance. Run only local
def testLotOfRequest():
"""Test if request are completed when server says: 'no more' """
global user
i = 0
while i<80:
while i<40:
user._contributions = 0
user.getData()
i+=1
ok_(user._contributions!=0, "Lot of request fail")
'''

0 comments on commit c393901

Please sign in to comment.