Changeset f53d684 in sasview for test/sascalculator


Ignore:
Timestamp:
Dec 5, 2017 12:31:07 PM (7 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)

Location:
test/sascalculator/test
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • test/sascalculator/test/utest_sas_gen.py

    r1d014cb rf53d684  
    22Unit tests for the sas_gen 
    33""" 
     4 
     5import os.path 
    46import warnings 
    57warnings.simplefilter("ignore") 
     
    79import unittest 
    810from sas.sascalc.calculator import sas_gen 
     11 
     12 
     13def find(filename): 
     14    return os.path.join(os.path.dirname(__file__), filename) 
    915 
    1016 
     
    2026        Test .sld file loaded 
    2127        """ 
    22         f = self.sldloader.read("sld_file.sld") 
     28        f = self.sldloader.read(find("sld_file.sld")) 
    2329        self.assertEqual(f.pos_x[0], -40.5) 
    2430        self.assertEqual(f.pos_y[0], -13.5) 
     
    2935        Test .pdb file loaded 
    3036        """ 
    31         f = self.pdbloader.read("c60.pdb") 
     37        f = self.pdbloader.read(find("c60.pdb")) 
    3238        self.assertEqual(f.pos_x[0], -0.733) 
    3339        self.assertEqual(f.pos_y[0], -1.008) 
     
    3844        Test .omf file loaded 
    3945        """ 
    40         f = self.omfloader.read("A_Raw_Example-1.omf") 
     46        f = self.omfloader.read(find("A_Raw_Example-1.omf")) 
    4147        output = sas_gen.OMF2SLD() 
    4248        output.set_data(f) 
  • test/sascalculator/test/utest_slit_length_calculator.py

    rb09095a rf53d684  
    33""" 
    44 
     5import os.path 
    56import unittest 
    67from sas.sascalc.dataloader.readers.ascii_reader import Reader 
    78from sas.sascalc.calculator.slit_length_calculator import SlitlengthCalculator \ 
    89    as calculator 
     10 
     11 
     12def find(filename): 
     13    return os.path.join(os.path.dirname(__file__), filename) 
    914 
    1015 
     
    1924            Test slit_length_calculator" 
    2025        """ 
    21         list = self.reader.read("beam profile.DAT") 
     26        list = self.reader.read(find("beam profile.DAT")) 
    2227        self.assertTrue(len(list) == 1) 
    2328        f = list[0] 
Note: See TracChangeset for help on using the changeset viewer.