Changeset 222aa11 in flex_extract.git for python


Ignore:
Timestamp:
Sep 10, 2018, 8:54:42 AM (6 years ago)
Author:
Anne Philipp <anne.philipp@…>
Branches:
master, ctbto, dev
Children:
3232589
Parents:
308e144
Message:

added pathes in config file and according testcases

Location:
python
Files:
2 added
9 edited

Legend:

Unmodified
Added
Removed
  • python/CONTROL.test

    r54a8a01 r222aa11  
    77EXPVER 1
    88GRID 5000 
    9 LEFT -15000
     9LEFT -10000
    1010LOWER 30000
    11 UPPER 75000
    12 RIGHT 45000
    13 LEVELIST 55/to/60
     11UPPER 40000
     12RIGHT 10000
     13LEVELIST 59/to/60
    1414RESOL 63
    1515GAUSS 1
  • python/_config.py

    rdda0e9d r222aa11  
    2929
    3030# add path to pythonpath
    31 LOCAL_PYTHON_PATH = os.path.dirname(os.path.abspath(
     31PATH_LOCAL_PYTHON = os.path.dirname(os.path.abspath(
    3232    inspect.getfile(inspect.currentframe())))
    33 if LOCAL_PYTHON_PATH not in sys.path:
    34     sys.path.append(LOCAL_PYTHON_PATH)
     33if PATH_LOCAL_PYTHON not in sys.path:
     34    sys.path.append(PATH_LOCAL_PYTHON)
     35
     36PATH_FLEXEXTRACT_DIR = os.path.normpath(os.path.dirname(os.path.abspath(
     37    inspect.getfile(inspect.currentframe()))) + '/../')
     38
     39PATH_TEMPLATES = os.path.join(PATH_FLEXEXTRACT_DIR + os.path.sep +
     40                              '_templates')
    3541
    3642# path to gribtable
    37 PATH_GRIBTABLE = LOCAL_PYTHON_PATH + '/templates/ecmwf_grib1_table_128'
     43PATH_GRIBTABLE = os.path.join(PATH_TEMPLATES + os.path.sep +
     44                              'ecmwf_grib1_table_128')
    3845
     46PATH_RUN_DIR = os.path.join(PATH_FLEXEXTRACT_DIR + os.path.sep +
     47                                'run')
     48
     49PATH_CONTROLFILES = os.path.join(PATH_RUN_DIR + os.path.sep +
     50                                'control')
  • python/install.py

    r97e09f4 r222aa11  
    263263                               ecd + 'python/*temp* ' +
    264264                               ecd + 'python/ECMWF_ENV ' +
    265                                ecd + 'grib_templates ' +
     265                               ecd + '_templates ' +
    266266                               ecd + 'src/*.f ' +
    267267                               ecd + 'src/*.f90 ' +
  • python/job.ksh

    r54a8a01 r222aa11  
    6868ectrans 1
    6969ecuid km4a
    70 end_date 20000101
     70end_date 20100606
    7171eta 0
    7272etadiff 0
     
    8181install_target None
    8282job_template job.temp
    83 left -15000
     83left -10000
    8484level 60
    85 levelist 55/to/60
     85levelist 59/to/60
    8686lower 30000
    8787mailfail ${USER}
     
    9797queue ecgate
    9898resol 63
    99 right 45000
     99right 10000
    100100smooth 0
    101 start_date 20000101
     101start_date 20100606
    102102step 00 01 02 03 04 05 00 07 08 09 10 11 00 01 02 03 04 05 00 07 08 09 10 11
    103103stream OPER
    104104time 00 00 00 00 00 00 06 00 00 00 00 00 12 12 12 12 12 12 18 12 12 12 12 12
    105105type AN FC FC FC FC FC AN FC FC FC FC FC AN FC FC FC FC FC AN FC FC FC FC FC
    106 upper 75000
     106upper 40000
    107107wrf 0
    108108EOF
  • python/pythontest/.cache/v/cache/lastfailed

    r308e144 r222aa11  
    11{
    2   "TestTools.py::TestTools::()": true,
    3   "TestTools.py::TestTools::()::test_failany_silent_remove": true,
    42  "TestTools.py::TestTools::test_init128": true,
    53  "TestTools.py::TestTools::test_to_param_id": true
  • python/pythontest/TestInput.py

    r067a0c3 r222aa11  
    55import os
    66import sys
     7
    78sys.path.append('../python')
    89from ControlFile import ControlFile
  • python/pythontest/TestPathes.py

    rdda0e9d r222aa11  
    99import _config
    1010
     11def test_path_localpython():
     12    assert os.path.exists(_config.PATH_LOCAL_PYTHON) == 1
     13
     14def test_path_flexextract():
     15    assert os.path.exists(_config.PATH_FLEXEXTRACT_DIR) == 1
     16
     17def test_path_flexextract_name():
     18    version = _config._VERSION_STR
     19    flexextract_name = 'flex_extract_v' + version
     20    assert os.path.basename(_config.PATH_FLEXEXTRACT_DIR) == flexextract_name
     21
     22def test_path_templates():
     23    assert os.path.exists(_config.PATH_TEMPLATES) == 1
    1124
    1225def test_path_vtable():
     
    1629    assert os.path.isfile(_config.PATH_GRIBTABLE) == 1
    1730
     31def test_path_run():
     32    assert os.path.exists(_config.PATH_RUN_DIR) == 1
     33
     34def test_path_control():
     35    assert os.path.exists(_config.PATH_CONTROLFILES) == 1
  • python/pythontest/TestTools.py

    r308e144 r222aa11  
    2424
    2525    def test_get_cmdline_arguments(self):
    26         '''
    27         '''
    2826        cmd_dict_control = {'start_date':'20180101',
    2927                            'end_date':'20180101',
     
    6462
    6563    def test_init128(self):
    66         '''
    67         '''
    6864        table128 = init128(_config.PATH_GRIBTABLE)
    6965        expected = {'078': 'TCLW', '130': 'T', '034': 'SST'}
     
    7369
    7470    def test_to_param_id(self):
    75         '''
    76         '''
    7771        table128 = init128(_config.PATH_GRIBTABLE)
    7872        pars = to_param_id("T/SP/LSP/SSHF", table128)
     
    8175
    8276    def test_my_error(self):
    83         '''
    84         '''
    8577        with pytest.raises(SystemExit) as pytest_wrapped_e:
    8678            my_error(['${USER}', 'anne.philipp@univie.ac.at'], 'Failed!')
     
    8981
    9082    def test_read_ecenv(self):
    91         '''
    92         '''
    9383        envs_ref = {'ECUID': 'km4a',
    9484                    'ECGID': 'at',
     
    10191
    10292    def test_clean_up(self):
     93
    10394        assert True
    10495
     
    123114        assert os.path.isfile(testfile) == False
    124115        assert out == ''
    125 #
    126 #    def test_failany_silent_remove(self):
    127 #        testfile = 'testfileany.test'
    128 #        with pytest.raises(OSError) as pytest_wrapped_e:
    129 #            silent_remove(testfile)
    130 #        #out, err = capfd.readouterr()
    131 #        #assert os.path.isfile(testfile) == False
    132 #        #assert out == ''
    133116
    134     def test_get_list_as_string(self):
    135         assert True
     117    @pytest.mark.skip(reason="no way of currently testing this")
     118    def test_failany_silent_remove(self):
     119        testfile = 'testfileany.test'
     120        with pytest.raises(OSError) as pytest_wrapped_e:
     121            silent_remove(testfile)
     122        #out, err = capfd.readouterr()
     123        #assert os.path.isfile(testfile) == False
     124        #assert out == ''
     125
     126    def test_success_get_list_as_string(self):
     127        list_object =  [1, 2, 3, '...', 'testlist']
     128        list_as_string = '1, 2, 3, ..., testlist'
     129        assert list_as_string == get_list_as_string(list_object)
     130
     131    @pytest.mark.skip(reason="no way of currently testing this")
     132    def test_fail_get_list_as_string(self):
     133        list_object =  [1, 2, 3, '...', 'testlist']
     134        list_as_string = '1, 2, 3, ..., testlist'
     135        with pytest.raises(Exception) as pytest_wrapped_e:
     136            result = get_list_as_string(list_object)
     137        assert result == list_as_string
    136138
    137139    def test_warningexist_make_dir(self, capfd):
  • python/submit.py

    r763fcf6 r222aa11  
    8181    except IOError:
    8282        try:
    83             c = ControlFile(LOCAL_PYTHON_PATH + args.controlfile)
     83            c = ControlFile(_config.PATH_LOCAL_PYTHON + args.controlfile)
    8484        except IOError:
    8585            print 'Could not read CONTROL file "' + args.controlfile + '"'
Note: See TracChangeset for help on using the changeset viewer.
hosted by ZAMG