test fails if run from top directory
error message:
(test_env) oliskir@svalbard:~/src/meridian/sound_classification$ pytest
================================================================================ test session starts =================================================================================
platform linux -- Python 3.6.5, pytest-3.6.2, py-1.5.4, pluggy-0.6.0
rootdir: /home/oliskir/src/meridian/sound_classification, inifile:
collected 1 item
sound_classification/tests/test_pre_processing.py E [100%]
======================================================================================= ERRORS =======================================================================================
___________________________________________________________________ ERROR at setup of test_standardize_sample_rate ___________________________________________________________________
sine_wave = (44100, array([ 0. , 92.89413325, 185.78751222, ..., -278.67938265,
-185.78751223, -92.89413325]))
@pytest.fixture
def sine_wave_file(sine_wave):
"""Create a .wav with the 'sine_wave()' fixture
The file is saved as ./assets/sine_wave.wav.
When the tests using this fixture are done,
the file is deleted.
Yields:
wav_file : str
A string containing the path to the .wav file.
"""
wav_file = "./assets/sine_wave.wav"
rate, sig = sine_wave
> pp.wave.write(wav_file, rate=rate, data=sig)
sound_classification/tests/test_pre_processing.py:73:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
filename = './assets/sine_wave.wav', rate = 44100, data = array([ 0. , 92.89413325, 185.78751222, ..., -278.67938265,
-185.78751223, -92.89413325])
def write(filename, rate, data):
"""
Write a numpy array as a WAV file.
Parameters
----------
filename : string or open file handle
Output wav file.
rate : int
The sample rate (in samples/sec).
data : ndarray
A 1-D or 2-D numpy array of either integer or float data-type.
Notes
-----
* Writes a simple uncompressed WAV file.
* To write multiple-channels, use a 2-D array of shape
(Nsamples, Nchannels).
* The bits-per-sample and PCM/float will be determined by the data-type.
Common data types: [1]_
===================== =========== =========== =============
WAV format Min Max NumPy dtype
===================== =========== =========== =============
32-bit floating-point -1.0 +1.0 float32
32-bit PCM -2147483648 +2147483647 int32
16-bit PCM -32768 +32767 int16
8-bit PCM 0 255 uint8
===================== =========== =========== =============
Note that 8-bit PCM is unsigned.
References
----------
.. [1] IBM Corporation and Microsoft Corporation, "Multimedia Programming
Interface and Data Specifications 1.0", section "Data Format of the
Samples", August 1991
http://www.tactilemedia.com/info/MCI_Control_Info.html
"""
if hasattr(filename, 'write'):
fid = filename
else:
> fid = open(filename, 'wb')
E FileNotFoundError: [Errno 2] No such file or directory: './assets/sine_wave.wav'
../../../test_env/lib/python3.6/site-packages/scipy/io/wavfile.py:328: FileNotFoundError
============================================================================== 1 error in 0.24 seconds ===============================================================================
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information