Ignore:
Timestamp:
Dec 5, 2017 12:31:07 PM (6 years ago)
Author:
Paul Kienzle <pkienzle@…>
Branches:
master, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
5bb05a4
Parents:
3053a4a
git-author:
Stuart Prescott <llimeht@…> (12/05/17 12:31:07)
git-committer:
Paul Kienzle <pkienzle@…> (12/05/17 12:31:07)
Message:

Make tests work from any directory and functional without special runner script (#124)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/sasdataloader/test/utest_averaging.py

    rfe15198 rf53d684  
    1313                                                  SlabY, get_q, 
    1414                                                  reader2D_converter) 
     15 
     16 
     17def find(filename): 
     18    return os.path.join(os.path.dirname(__file__), filename) 
    1519 
    1620 
     
    102106 
    103107    def setUp(self): 
    104         filepath = os.path.join(os.path.dirname( 
    105             os.path.realpath(__file__)), 'MAR07232_rest.h5') 
     108        filepath = find('MAR07232_rest.h5') 
    106109        self.data_list = Loader().load(filepath) 
    107110        self.data = self.data_list[0] 
     
    118121 
    119122        o = r(self.data) 
    120         filepath = os.path.join(os.path.dirname( 
    121             os.path.realpath(__file__)), 'ring_testdata.txt') 
     123        filepath = find('ring_testdata.txt') 
    122124        answer_list = Loader().load(filepath) 
    123125        answer = answer_list[0] 
     
    140142        o = r(self.data) 
    141143 
    142         filepath = os.path.join(os.path.dirname( 
    143             os.path.realpath(__file__)), 'avg_testdata.txt') 
     144        filepath = find('avg_testdata.txt') 
    144145        answer = Loader().load(filepath)[0] 
    145146        for i in range(r.nbins_phi): 
     
    176177        o = r(self.data) 
    177178 
    178         filepath = os.path.join(os.path.dirname( 
    179             os.path.realpath(__file__)), 'slabx_testdata.txt') 
     179        filepath = find('slabx_testdata.txt') 
    180180        answer = Loader().load(filepath)[0] 
    181181        for i in range(len(o.x)): 
     
    195195        o = r(self.data) 
    196196 
    197         filepath = os.path.join(os.path.dirname( 
    198             os.path.realpath(__file__)), 'slaby_testdata.txt') 
     197        filepath = find('slaby_testdata.txt') 
    199198        answer = Loader().load(filepath)[0] 
    200199        for i in range(len(o.x)): 
     
    222221        o = r(self.data) 
    223222 
    224         filepath = os.path.join(os.path.dirname( 
    225             os.path.realpath(__file__)), 'ring_testdata.txt') 
     223        filepath = find('ring_testdata.txt') 
    226224        answer = Loader().load(filepath)[0] 
    227225        for i in range(len(o.x)): 
     
    240238        o = r(self.data) 
    241239 
    242         filepath = os.path.join(os.path.dirname( 
    243             os.path.realpath(__file__)), 'sectorphi_testdata.txt') 
     240        filepath = find('sectorphi_testdata.txt') 
    244241        answer = Loader().load(filepath)[0] 
    245242        for i in range(len(o.x)): 
     
    258255        o = r(self.data) 
    259256 
    260         filepath = os.path.join(os.path.dirname( 
    261             os.path.realpath(__file__)), 'sectorq_testdata.txt') 
     257        filepath = find('sectorq_testdata.txt') 
    262258        answer = Loader().load(filepath)[0] 
    263259        for i in range(len(o.x)): 
Note: See TracChangeset for help on using the changeset viewer.