Changeset f53d684 in sasview for test/corfunc/test/utest_corfunc.py


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/corfunc/test/utest_corfunc.py

    r86ba9d6 rf53d684  
    44from __future__ import division, print_function 
    55 
     6import os.path 
    67import unittest 
    78import time 
     
    1112from sas.sascalc.corfunc.corfunc_calculator import CorfuncCalculator 
    1213from sas.sascalc.dataloader.data_info import Data1D 
     14 
     15 
     16def find(filename): 
     17    return os.path.join(os.path.dirname(__file__), filename) 
    1318 
    1419 
     
    3136        self.extrapolation = None 
    3237        self.transformation = None 
    33         self.results = [np.loadtxt(filename+"_out.txt").T[2] 
     38        self.results = [np.loadtxt(find(filename+"_out.txt")).T[2] 
    3439                        for filename in ("gamma1", "gamma3", "idf")] 
    3540 
     
    110115 
    111116def load_data(filename="98929.txt"): 
    112     data = np.loadtxt(filename, dtype=np.float64) 
     117    data = np.loadtxt(find(filename), dtype=np.float64) 
    113118    q = data[:,0] 
    114119    iq = data[:,1] 
Note: See TracChangeset for help on using the changeset viewer.