Ignore:
Timestamp:
Dec 19, 2018, 6:29:13 PM (5 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/timestretch, fix/ffmpeg5, master
Children:
b2e1740, d0f19a7, f5adffe
Parents:
a617bf3 (diff), 74c1fb9 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'feature/pytest' (closes #163)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/tests/utils.py

    ra617bf3 r0045668  
    99
    1010def array_from_text_file(filename, dtype = 'float'):
    11     filename = os.path.join(os.path.dirname(__file__), filename)
    12     with open(filename) as f:
    13         lines = f.readlines()
    14     return np.array([line.split() for line in lines],
    15             dtype = dtype)
     11    realpathname = os.path.join(os.path.dirname(__file__), filename)
     12    return np.loadtxt(realpathname, dtype = dtype)
    1613
    1714def list_all_sounds(rel_dir):
     
    3936        os.unlink(path)
    4037    except WindowsError as e:
    41         print("deleting {:s} failed ({:s}), reopening".format(path, repr(e)))
    42         with open(path, 'wb') as f:
    43             f.close()
    44         try:
    45             os.unlink(path)
    46         except WindowsError as f:
    47             print("deleting {:s} failed ({:s}), aborting".format(path, repr(e)))
     38        # removing the temporary directory sometimes fails on windows
     39        import warnings
     40        errmsg = "failed deleting temporary file {:s} ({:s})"
     41        warnings.warn(UserWarning(errmsg.format(path, repr(e))))
    4842
    4943def array_from_yaml_file(filename):
Note: See TracChangeset for help on using the changeset viewer.