From 1947d8243f6dc7ef9433e529f89b218488fee1fc Mon Sep 17 00:00:00 2001 From: David Date: Mon, 5 Mar 2018 15:03:06 +0100 Subject: [PATCH 1/2] remove uproot from tests --- PhysicsTools/PythonAnalysis/test/imports.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/PhysicsTools/PythonAnalysis/test/imports.py b/PhysicsTools/PythonAnalysis/test/imports.py index aa281f280496f..c2b7c2d5b5e20 100755 --- a/PhysicsTools/PythonAnalysis/test/imports.py +++ b/PhysicsTools/PythonAnalysis/test/imports.py @@ -25,14 +25,15 @@ print l -skipIt=['pytest','climate','theanets','hyperopt','thriftpy'] +skipIt=['pytest','climate','theanets','hyperopt','thriftpy','uproot'] # climate misses plac # pytest misses py # theanets misses plac -# xrootdpyfs misses from fs.errors import DestinationExistsError, DirectoryNotEmptyError, \ -#ImportError: cannot import name DestinationExistsError #hyperopt misses builtins #thriftpy misses ply +#unless the llvm version in cmssw matches that of root, uproot needs to be +#tested separately (https://github.com/scikit-hep/uproot/issues/58) + import importlib err = 0 for i in l: From 2b2efb737255f0ba56fb4e7fefe6f1a1b2764f5e Mon Sep 17 00:00:00 2001 From: David Date: Mon, 5 Mar 2018 15:33:49 +0100 Subject: [PATCH 2/2] import each python pkg independently --- PhysicsTools/PythonAnalysis/test/imports.py | 44 ++++++++++++++------- PhysicsTools/PythonAnalysis/test/imports.sh | 6 ++- 2 files changed, 35 insertions(+), 15 deletions(-) diff --git a/PhysicsTools/PythonAnalysis/test/imports.py b/PhysicsTools/PythonAnalysis/test/imports.py index c2b7c2d5b5e20..a1cddff3f0bbc 100755 --- a/PhysicsTools/PythonAnalysis/test/imports.py +++ b/PhysicsTools/PythonAnalysis/test/imports.py @@ -1,6 +1,21 @@ #!/usr/bin/env python import traceback import os, sys +#import gc + +#class Importer: +# def __init__(self,name): +# self.error=0 +# try: +# importlib.import_module(i) +# print "Done" +# except Exception as e: +# print "Fail" +# print traceback.format_exc() +# self.error = 1 +# +# def err(self): +# return self.error baseDirs=[] from subprocess import Popen,PIPE @@ -23,9 +38,8 @@ l.append(file) break -print l - -skipIt=['pytest','climate','theanets','hyperopt','thriftpy','uproot'] +#print l +skipIt=['pytest','climate','theanets','hyperopt','thriftpy'] # climate misses plac # pytest misses py # theanets misses plac @@ -34,16 +48,18 @@ #unless the llvm version in cmssw matches that of root, uproot needs to be #tested separately (https://github.com/scikit-hep/uproot/issues/58) -import importlib -err = 0 + +#import importlib +#err = 0 for i in l: if i in skipIt: continue - print "Importing",i,".....", - try: - importlib.import_module(i) - print "Done" - except Exception as e: - print "Fail" - print traceback.format_exc() - err += 1 -sys.exit(err) + print i +# +# if i in skipIt: continue +# print "Importing",i,".....", +# d=Importer(i) +# err+=d.err() +# del d +# gc.collect() +# +#sys.exit(err) diff --git a/PhysicsTools/PythonAnalysis/test/imports.sh b/PhysicsTools/PythonAnalysis/test/imports.sh index 41a23cd40b136..4678f56a8a462 100755 --- a/PhysicsTools/PythonAnalysis/test/imports.sh +++ b/PhysicsTools/PythonAnalysis/test/imports.sh @@ -15,7 +15,11 @@ python -c 'import theano; print(theano.config)' echo ">>> Cleaning compile cache" theano-cache clear -python ${CMSSW_BASE}/src/PhysicsTools/PythonAnalysis/test/imports.py +for i in $(python ${CMSSW_BASE}/src/PhysicsTools/PythonAnalysis/test/imports.py) +do + echo "importing $i" + python -c "import $i" +done echo ">>> Cleaning compile cache" theano-cache clear