Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
[CORALCOOL-2406] Add a python 'compile' step to catch API changes in example code Created: 11/Apr/06 Updated: 23/Sep/14 Resolved: 23/Sep/14 Status: Project: Component/s: Affects Version/s: Fix Version/s: Closed CORAL and COOL PyCool None Type: Reporter: Resolution: Labels: Remaining Estimate: Time Spent: Original Estimate: Task Priority: Sven A. Schmidt (Inactive) Assignee: Won't Fix Votes: None Not Specified External issue ID: External issue URL: task3345 None High Sven A. Schmidt (Inactive) 0 Not Specified Not Specified http://savannah.cern.ch/task/?3345 Description 1.2.9 -> 1.3.0 API changes were not reflected in the PyCool/examples, because we don't run them routinely. C++ examples are covered by the compiler, we should add a similar validation to the python code. -sas Comments Comment by Sven A. Schmidt (Inactive) [ 11/Apr/06 ] > Yes indeed. Check inside Python_makefile.mk and the platform specific makefile > fragments. I just tried but that compile step doesn't catch "import pool". It happily does that. Such is dynamicism ;) The problem with pychecker is that it isn't in the LCG python 2.4.2. (It's not (yet) a standard module.) Instead I tried the following: #!/usr/bin/env python import sys, glob, os, imp exampleDir = '../examples' examples = glob.glob( exampleDir + os.path.sep + '*.py' ) moduleNames = [ os.path.basename(f)[:-3] for f in examples ] errors = [] for fileName in examples: try: moduleName = os.path.basename(fileName)[:-3] print 'Loading', moduleName imp.load_source( moduleName, fileName ) except Exception, e: errors.append( e ) if len(errors) == 0: print "Examlpes OK" else: print "%i errors in examples:" % len(errors) for e in errors: print e ------------------------------------------This works ok, the problem is that the "cool.py" example expects a connect string argument and when it's missing the above reports an error. I have the feeling going beyond this is overkill. We could also run the examples and diff the output against a reference output similar to what OVAL does. Cheers, Sven Comment by Sven A. Schmidt (Inactive) [ 10/Aug/07 ] Closing this. The initial problem was when we had to manually extend the PyCool interfaces with any API changes made on the C++ side. Since Marco added all the nifty magic to get this for free we don't need this safeguard anymore. Generated at Fri May 12 19:19:18 CEST 2017 using JIRA 7.2.7#72009sha1:68b7d86b7e8716f76c1f28a5095acccf67bb75b1.