Changeset - 884fbc541d8d
[Not reviewed]
beta
0 1 0
Marcin Kuzminski - 14 years ago 2012-04-30 17:25:01
marcin@python-works.com
added more repos to crawler
1 file changed with 5 insertions and 1 deletions:
0 comments (0 inline, 0 general)
rhodecode/tests/rhodecode_crawler.py
Show inline comments
 
@@ -24,49 +24,53 @@
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 

	
 

	
 
import cookielib
 
import urllib
 
import urllib2
 
import time
 
import os
 
import sys
 
from os.path import join as jn
 
from os.path import dirname as dn
 

	
 
__here__ = os.path.abspath(__file__)
 
__root__ = dn(dn(dn(__here__)))
 
sys.path.append(__root__)
 

	
 
from rhodecode.lib import vcs
 

	
 
BASE_URI = 'http://127.0.0.1:5001/%s'
 
PROJECT_PATH = jn('/', 'home', 'marcink', 'hg_repos')
 
PROJECTS = ['CPython', 'rhodecode_tip', 'mastergmat']
 
PROJECTS = [
 
    'linux-magx-pbranch',
 
    'CPython',
 
    'rhodecode_tip',
 
]
 

	
 

	
 
cj = cookielib.FileCookieJar('/tmp/rc_test_cookie.txt')
 
o = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
 
o.addheaders = [
 
    ('User-agent', 'rhodecode-crawler'),
 
    ('Accept-Language', 'en - us, en;q = 0.5')
 
]
 

	
 
urllib2.install_opener(o)
 

	
 

	
 
def test_changelog_walk(proj, pages=100):
 
    total_time = 0
 
    for i in range(1, pages):
 

	
 
        page = '/'.join((proj, 'changelog',))
 

	
 
        full_uri = (BASE_URI % page) + '?' + urllib.urlencode({'page':i})
 
        s = time.time()
 
        f = o.open(full_uri)
 
        size = len(f.read())
 
        e = time.time() - s
 
        total_time += e
0 comments (0 inline, 0 general)