Exemplo n.º 1
0
 def test_nonempty_path(self):
     with mock.patch('os.listdir') as fake_listdir, \
       mock.patch('os.stat') as fake_stat, \
       mock.patch('main.getpwuid') as fake_getpwuid:
         fake_listdir.return_value = [TEST_FILENAME]
         fake_stat.return_value = FakeStat
         fake_getpwuid.return_value = FakePwuId
         result = list_files('dir')
     expected = {
         'files': [{
             'filename': TEST_FILENAME,
             'sizeBytes': TEST_SIZE,
             'owner': TEST_USER,
             'permissions': oct(TEST_MODE),
         }],
     }
     assert result == expected
from montecarlo import mc_run as montecarlo
basepath = os.path.join('C:\\', 'TEMP',
                        'tp89957cff_f6cf_463c_b154_eac2aabe2c78',
                        'HRM-2_20-16')

path = [os.path.join(basepath, H) for H in [
    '0.6',
    '0.7',
    '0.8',
    '0.9',
]]

delta_method = 'med'

for p in path:
    files = list_files(p, pattern=r"\.mat$")
    ## Pick the first file and pares its name
    print("Sweeping through %s: %d files found." % (
        p,
        len(files),
    ))
    ## Pick the first file and extract as much information as possible from its filename
    prefix, size, hurst = os.path.basename(files[0]).split("_")[:3]
    hurst = "%0.5f" % (float(hurst), )
    ## Get the current timestamp
    run_dttm = datetime.utcnow()
    result = list()
    for f in files:
        ## Load the Matlab data
        mat = io.loadmat(f)
        X = mat['data'][0]
def test_list_files(app):
    with app.test_request_context():
        res = main.list_files(flask.request)
        assert 'main.py' in res
Exemplo n.º 4
0
 def test_exception_when_empty(self):
     with pytest.raises(InvalidPathError):
         list_files('empty_dir')
Exemplo n.º 5
0
def test_list_files(app):
    with app.test_request_context():
        res = main.list_files(flask.request)
        assert 'main.py' in res