CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/PKGTOOLS/tests/test_DownloadDQM.py

Go to the documentation of this file.
00001 from os.path import join, abspath, exists, dirname
00002 from os import makedirs
00003 from shutil import rmtree
00004 import sys
00005 import md5
00006 import tarfile
00007 
00008 from cmsBuild import DownloadOptions, initDownloadHandlers
00009 from cmsBuild import parseCvsUrl, downloadCvs
00010 
00011 downloadDir = join (dirname (abspath (__file__)), "testtmp")
00012 if exists (downloadDir):
00013     rmtree (downloadDir)
00014 makedirs (downloadDir)
00015 
00016 initDownloadHandlers ()
00017 options = DownloadOptions  ()
00018 options.workDir = abspath (downloadDir)
00019 options.verbose = True
00020 
00021 cvsurl = """cvs://:pserver:anonymous@cmscvs.cern.ch:2401/cvs_server/repositories/CMSSW?passwd=AA_:yZZ3e&strategy=checkout&module=CMSSW/VisMonitoring/DQMServer&nocache=true&export=VisMonitoring/DQMServer&tag=-rV04-01-01&output=/DQMServer.tar.gz"""
00022 protocol, cvsroot, args = parseCvsUrl (cvsurl)
00023 print args
00024 assert (protocol == "cvs")
00025 assert (cvsroot == ":pserver:anonymous@cmscvs.cern.ch:2401/cvs_server/repositories/CMSSW")
00026 assert (args["passwd"] == "AA_:yZZ3e")
00027 assert (args["module"] == "CMSSW/VisMonitoring/DQMServer")
00028 assert (args["export"] == "VisMonitoring/DQMServer")
00029 assert (args["tag"] == "V04-01-01")
00030 assert (args["output"] == "/DQMServer.tar.gz")
00031 assert (downloadCvs (cvsurl, downloadDir, options))
00032 
00033 m=md5.new ()
00034 m.update (file (join (downloadDir, "DQMServer.tar.gz")).read ())
00035 
00036 tf = tarfile.open(join (downloadDir, "DQMServer.tar.gz"), "r:gz")
00037 tf.getmember("VisMonitoring/DQMServer//")
00038 rmtree(downloadDir)