mailRe: r3234 - /1.3/test_suite/unit_tests/unit_test_runner.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by Gary S. Thompson on March 19, 2007 - 16:13:

Subject: Re: r3234 - /1.3/test_suite/unit_tests/unit_test_runner.py From: "Gary S. Thompson" <garyt@xxxxxxxxxxxxxxx> Date: Mon, 19 Mar 2007 11:01:39 +0000

To:
Edward d'Auvergne <edward@xxxxxxxxxxxxx>
CC:
relax-commits@xxxxxxx


Edward d'Auvergne wrote:

Whoops, I stuffed that one up!  I thought that 'module_path' was the
file system path to the module, i.e.
'./test_suite/unit_tests/data/test___init__.py', and that the split
statement was to remove the first dot and the '.py' at the end.  I
should have read the code around it for context!

To clear up my confusion, is 'module_path' the full module name?



I thinks so but will have to check ;-)

Are
all the 'path' references in variable names the ``dotted module
names'', for example 'generic_fns.residue.create'? Is the
'offset_path' keyword argument of the 'get_first_instance_path()'
method referring to the current directory



definitley directores in this case. I will try and have a proper look at whats going on tonight



or the module/package
seperator '.'?  I'll go through tomorrow and fix all my mistakes.
Until then relax (the 1.3 line) should operate on all systems
excluding Mac OS 9.

Cheers,

Edward


regards gary


On 3/19/07, Gary S. Thompson <garyt@xxxxxxxxxxxxxxx> wrote:

edward@xxxxxxxxxxxxx wrote:

Hi Ed
Good to hear! I will take some time ot have a proper look through,
however, one thing struck me at a first look: consider line 115

components = module_path.split('.')

vs

components = module_path.split(os.curdir)



This one is I believe wrong ;-( We are splitting a python path here (and
almost anywhere else you see a '.' used in split this will be the case)
This doesn't need to be replaced by os.curdir and would fail on an older
mac for instance

regards
gary

>Author: bugman
>Date: Mon Mar 19 07:20:17 2007
>New Revision: 3234
>
>URL: http://svn.gna.org/viewcvs/relax?rev=3234&view=rev
>Log:
>Updated the unit test runner to be cross platform compatible.
>
>
>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=3234&r1=3233&r2=3234&view=diff


>==============================================================================

>--- 1.3/test_suite/unit_tests/unit_test_runner.py (original)
>+++ 1.3/test_suite/unit_tests/unit_test_runner.py Mon Mar 19 07:20:17 2007
>@@ -115,7 +115,7 @@
>
> if module != None:
> result = [module]
>- components = module_path.split('.')
>+ components = module_path.split(os.curdir)
> for component in components[1:]:
> module = getattr(module, component)
> result.append(module)
>@@ -162,10 +162,10 @@
> break
>
> if relative_path != None:
>- relative_path = '.'.join(relative_path)
>+ relative_path = os.curdir.join(relative_path)
>
> if relative_path != '':
>- relative_path = '.'.join((relative_path, module_name))
>+ relative_path = os.curdir.join((relative_path, module_name))
> else:
> relative_path = module_name
>
>@@ -347,10 +347,10 @@
>
>
> path = ['']
>- for elem in module_path.split('.'):
>- old_path_key = '.'.join(path)
>+ for elem in module_path.split(os.curdir):
>+ old_path_key = os.curdir.join(path)
> path.append(elem)
>- path_key = '.'.join(path)
>+ path_key = os.curdir.join(path)
> if path_key not in suite_dictionary:
> test_suite = unittest.TestSuite()
> suite_dictionary[path_key]=test_suite
>@@ -376,11 +376,12 @@
> ''' @type TEST_SUITE_ROOT: string
> @ivar TEST_SUITE_ROOT: constant indicating the use of the current unit test suite found from the root_path'''
>
>- CURRENT_DIRECTORY='.'
>- ''' @type CURRENT_DIRECTORY: string
>- @ivar CURRENT_DIRECTORY: internal constant defining a name for the current directory on all platforms'''
>-
>- system_path_pattern = ['test_suite/unit_tests','../..']
>+ # Unused.
>+ #CURRENT_DIRECTORY='.'
>+ #''' @type CURRENT_DIRECTORY: string
>+ # @ivar CURRENT_DIRECTORY: internal constant defining a name for the current directory on all platforms'''
>+
>+ system_path_pattern = ['test_suite' + os.sep + 'unit_tests', os.pardir + os.sep + os.pardir]
> ''' @type system_path_pattern: list of strings
> @ivar system_path_pattern: a search template for the directory in which relax is installed.
> The directory which relax is installed in is viewed as the the 'PYTHONPATH'
>@@ -392,7 +393,7 @@
> value of root_path in the file system.
> '''
>
>- unit_test_path_pattern = ['test_suite/unit_tests','.']
>+ unit_test_path_pattern = ['test_suite' + os.sep + 'unit_tests', os.curdir]
> ''' @type unit_test_path_pattern: a list of strings
> @ivar unit_test_path_pattern: a search template for the directory from which all unit
> module directories descend. For the current setup in relax
>@@ -409,7 +410,7 @@
> the module to be searched for would be test_float.Test_float.
> '''
>
>- def __init__(self, root_path='.', test_module=None, search_for_root_path=True,
>+ def __init__(self, root_path=os.curdir, test_module=None, search_for_root_path=True,
> search_for_unit_test_path=True, verbose = False):
> '''Initialise the unit test runner.
>
>@@ -459,7 +460,7 @@
> root_path = self.find_unit_test_directory_path(root_path)
>
> # deal with using pwd
>- elif root_path == self.CURRENT_DIRECTORY:
>+ elif root_path == os.curdir:
> root_path = os.getcwd()
>
> self.root_path = root_path
>@@ -506,7 +507,7 @@
> #deal with test_module
> if test_module == None:
> test_module=self.root_path
>- elif test_module == self.CURRENT_DIRECTORY:
>+ elif test_module == os.curdir:
> test_module = os.getcwd()
> elif test_module == self.TEST_SUITE_ROOT:
> test_module = self.unit_test_directory
>@@ -524,7 +525,7 @@
>
>
>
>- def get_first_instance_path(self, path, target_path, offset_path='.'):
>+ def get_first_instance_path(self, path, target_path, offset_path=os.curdir):
> '''Get the minimal path searching up the file system to target_directory.
>
> the algorithm is that we repeatedly chop the end off path and see if
>@@ -611,7 +612,7 @@
>
> # check for current working directory
> if test_module == None:
>- result.add('.')
>+ result.add(os.curdir)
> else:
> # add a direct file
> mpath = []
>@@ -629,7 +630,7 @@
> result.add(tuple(mpath))
>
>
>- module_path_elems = test_module.split('.')
>+ module_path_elems = test_module.split(os.curdir)
>
>
> module_norm_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
>
>.
>
>
>



-- ------------------------------------------------------------------- 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 -------------------------------------------------------------------




_______________________________________________ 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
-------------------------------------------------------------------





Related Messages


Powered by MHonArc, Updated Mon Mar 19 16:40:29 2007