Edward d'Auvergne wrote:
Sorry about the 12 day late response!
thats fine I can name at least three messages which I still haven't
answered weeks later ;-)
I think that the
ExtendedException class would be better served with a RelaxError. The
class could be moved into the 'relax_errors' module and the
'***WARNING:' part of the string dropped. This would bring the
exception into the standard relax system without affecting the unit
test runner. Gary, what do you think of the idea?
I am not so keen for several reasons.
1. This will add a dependency on relax and currently the whole
unit_test_runner framework is competely indepdendent of relax, except
for the names of directories in search paths etc
cf lines 61-64 of unit_test_runner
import os,re,unittest,string,sys
from optparse import OptionParser
from textwrap import dedent
from copy import copy
2. this exception does actually get thrown, it is a true exception
within the spirit of the junit framework and not a warning
3. this is an error not a warning! The part of the message with
'warning' after it is the result of the real exception which is the
syntax exception
regards
gary
Cheers,
Edward
On 3/31/07, garyt@xxxxxxxxxxxxxxx <garyt@xxxxxxxxxxxxxxx> wrote:
Author: varioustoxins
Date: Fri Mar 30 16:11:44 2007
New Revision: 3257
URL: http://svn.gna.org/viewcvs/relax?rev=3257&view=rev
Log:
unit_test_runner emits a better warning messages that no tests from
a module with a syntax error will be run
Modified:
1.3/test_suite/unit_tests/unit_test_runner.py
Modified: 1.3/test_suite/unit_tests/unit_test_runner.py
URL:
http://svn.gna.org/viewcvs/relax/1.3/test_suite/unit_tests/unit_test_runner.py?rev=3257&r1=3256&r2=3257&view=diff
==============================================================================
--- 1.3/test_suite/unit_tests/unit_test_runner.py (original)
+++ 1.3/test_suite/unit_tests/unit_test_runner.py Fri Mar 30 16:11:44 2007
@@ -249,6 +249,15 @@
return result
+class ExtendedException(Exception):
+ def __init__(self,e,module):
+ self.e=e
+ self.module=module
+ def __str__(self):
+ result = self.e.__str__()
+ result = result + '\n\n***WARNING: no tests from module %s will be
run!!!' % self.module
+ return result
+
class ImportErrorTestCase(unittest.TestCase):
def __init__(self,module_name,syntax_error):
super(ImportErrorTestCase,self).__init__('testImportError')
@@ -288,7 +297,8 @@
# result.addTest(bad_syntax)
except Exception,e:
result = unittest.TestSuite()
- bad_syntax = ImportErrorTestCase('testImportError',e)
+ ee = ExtendedException(e,module_name)
+ bad_syntax = ImportErrorTestCase('testImportError',ee)
result.addTest(bad_syntax)
@@ -396,6 +406,7 @@
module_path = get_module_relative_path(dir_path,
module_found)
+ #FIXME add verbose search option
#if self.verbose:
# print 'loading module: ' + module_path
_______________________________________________
relax (http://nmr-relax.com)
This is the relax-commits mailing list
relax-commits@xxxxxxx
To unsubscribe from this list, get a password
reminder, or change your subscription options,
visit the list information page at
https://mail.gna.org/listinfo/relax-commits
_______________________________________________
relax (http://nmr-relax.com)
This is the relax-devel mailing list
relax-devel@xxxxxxx
To unsubscribe from this list, get a password
reminder, or change your subscription options,
visit the list information page at
https://mail.gna.org/listinfo/relax-devel
.
--
-------------------------------------------------------------------
Dr Gary Thompson
Astbury Centre for Structural Molecular Biology,
University of Leeds, Astbury Building,
Leeds, LS2 9JT, West-Yorkshire, UK Tel. +44-113-3433024
email: garyt@xxxxxxxxxxxxxxx Fax +44-113-2331407
-------------------------------------------------------------------