mirror of https://github.com/McSinyx/palace
Opt in Travis CI testing for Python 3.6 on macOS
/r/oddlyspecific
This commit is contained in:
parent
a2444f0eab
commit
11cda099a3
11
.travis.yml
11
.travis.yml
|
@ -9,13 +9,12 @@ env:
|
|||
global:
|
||||
- TWINE_USERNAME=__token__
|
||||
- MACOSX_DEPLOYMENT_TARGET=10.9
|
||||
- CIBW_MANYLINUX_X86_64_IMAGE=manylinux2014
|
||||
- CIBW_BEFORE_BUILD_LINUX=.ci/before-build-manylinux2014
|
||||
- CIBW_BEFORE_BUILD_MACOS=.ci/before-build-macos
|
||||
- CIBW_BEFORE_BUILD_LINUX=.ci/before-build-manylinux2014
|
||||
- CIBW_MANYLINUX_X86_64_IMAGE=manylinux2014
|
||||
- CIBW_REPAIR_WHEEL_COMMAND_MACOS=".ci/repair-whl-macos {wheel} {dest_dir}"
|
||||
- CIBW_TEST_REQUIRES=tox
|
||||
# CIBW_TEST_COMMAND_MACOS="tox -c /Users/travis/build/McSinyx/palace"
|
||||
- CIBW_TEST_COMMAND_LINUX="tox -c /project"
|
||||
- CIBW_TEST_COMMAND="tox -c {project}"
|
||||
|
||||
addons:
|
||||
homebrew:
|
||||
|
@ -36,11 +35,11 @@ jobs:
|
|||
- os: osx
|
||||
osx_image: xcode11.3
|
||||
language: shell
|
||||
env: CIBW_BUILD=cp37-macosx_x86_64
|
||||
env: CIBW_BUILD=cp37-macosx_x86_64 CIBW_TEST_COMMAND="true"
|
||||
- os: osx
|
||||
osx_image: xcode11.3
|
||||
language: shell
|
||||
env: CIBW_BUILD=cp38-macosx_x86_64
|
||||
env: CIBW_BUILD=cp38-macosx_x86_64 CIBW_TEST_COMMAND="true"
|
||||
- services: docker
|
||||
env: CIBW_BUILD=cp36-manylinux_x86_64
|
||||
- services: docker
|
||||
|
|
|
@ -62,18 +62,20 @@ def test_init_others(cls):
|
|||
with cls(): pass
|
||||
|
||||
|
||||
def test_nested_context_manager():
|
||||
"""Test if the context manager returns to the previous context."""
|
||||
with Device() as device, Context(device) as context:
|
||||
with Context(device): pass
|
||||
assert current_context() == context
|
||||
|
||||
|
||||
@mark.parametrize('data', [
|
||||
'air_absorption_factor', 'cone_angles', 'distance_range', 'doppler_factor',
|
||||
'gain', 'gain_auto', 'gain_range', 'group', 'looping', 'offset',
|
||||
'orientation', 'outer_cone_gains', 'pitch', 'position', 'radius',
|
||||
'relative', 'rolloff_factors', 'spatialize', 'stereo_angles', 'velocity'])
|
||||
def test_source_setter(data):
|
||||
with Device() as device, Context(device): source = Source()
|
||||
with raises(RuntimeError): setattr(source, data, getattr(source, data))
|
||||
|
||||
|
||||
def test_nested_context_manager():
|
||||
"""Test if the context manager returns to the previous context."""
|
||||
with Device() as device, Context(device) as context:
|
||||
with Context(device): pass
|
||||
assert current_context() == context
|
||||
"""Test setters of a Source when its context is not current."""
|
||||
with Device() as device, Context(device), Source() as source:
|
||||
with raises(RuntimeError), Context(device):
|
||||
setattr(source, data, getattr(source, data))
|
||||
|
|
|
@ -17,7 +17,9 @@
|
|||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with palace. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
from os import environ
|
||||
from os.path import abspath, dirname, join
|
||||
from platform import system
|
||||
from random import choices
|
||||
from subprocess import PIPE, run, CalledProcessError
|
||||
from sys import executable
|
||||
|
@ -40,12 +42,16 @@ REVERB_PRESETS = choices(reverb_preset_names, k=5)
|
|||
WAVEFORMS = ['sine', 'square', 'sawtooth',
|
||||
'triangle', 'impulse', 'white-noise']
|
||||
|
||||
travis_macos = bool(environ.get('TRAVIS')) and system() == 'Darwin'
|
||||
skipif_travis_macos = mark.skipif(travis_macos, reason='Travis CI for macOS')
|
||||
|
||||
|
||||
def capture(*argv):
|
||||
"""Return the captured standard output of the given Python script."""
|
||||
return run([executable, *argv], stdout=PIPE).stdout.decode()
|
||||
|
||||
|
||||
@skipif_travis_macos
|
||||
def test_event(aiff, flac, mp3, ogg, wav):
|
||||
"""Test the event handling example."""
|
||||
event = capture(EVENT, aiff, flac, mp3, ogg, wav)
|
||||
|
@ -57,6 +63,7 @@ def test_event(aiff, flac, mp3, ogg, wav):
|
|||
assert f'Playing {wav}' in event
|
||||
|
||||
|
||||
@skipif_travis_macos
|
||||
def test_hrtf(ogg):
|
||||
"""Test the HRTF example."""
|
||||
hrtf = capture(HRTF, ogg)
|
||||
|
@ -71,6 +78,7 @@ def test_info():
|
|||
run([executable, INFO, MADEUP_DEVICE], check=True)
|
||||
|
||||
|
||||
@skipif_travis_macos
|
||||
def test_latency(mp3):
|
||||
"""Test the latency example."""
|
||||
latency = capture(LATENCY, mp3)
|
||||
|
@ -79,6 +87,7 @@ def test_latency(mp3):
|
|||
assert 'Offset' in latency
|
||||
|
||||
|
||||
@skipif_travis_macos
|
||||
@mark.parametrize('preset', REVERB_PRESETS)
|
||||
def test_reverb(preset, flac):
|
||||
"""Test the reverb example."""
|
||||
|
@ -88,6 +97,7 @@ def test_reverb(preset, flac):
|
|||
assert f'Loading reverb preset {preset}' in reverb
|
||||
|
||||
|
||||
@skipif_travis_macos
|
||||
def test_stdec(aiff):
|
||||
"""Test the stdec example."""
|
||||
stdec = capture(STDEC, aiff)
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
# along with palace. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import aifc
|
||||
from os import environ
|
||||
from platform import system
|
||||
from unittest.mock import Mock
|
||||
from uuid import uuid4
|
||||
|
||||
|
@ -25,6 +27,10 @@ from palace import (channel_configs, sample_types, decode,
|
|||
from pytest import mark
|
||||
|
||||
|
||||
travis_macos = bool(environ.get('TRAVIS')) and system() == 'Darwin'
|
||||
skipif_travis_macos = mark.skipif(travis_macos, reason='Travis CI for macOS')
|
||||
|
||||
|
||||
def mock(message):
|
||||
"""Return the MessageHandler corresponding to the given message."""
|
||||
return type(''.join(map(str.capitalize, message.split('_'))),
|
||||
|
@ -36,6 +42,7 @@ def test_device_diconnected():
|
|||
"""Test the handling of device disconnected message."""
|
||||
|
||||
|
||||
@skipif_travis_macos
|
||||
def test_source_stopped(wav):
|
||||
"""Test the handling of source stopped message."""
|
||||
with Device() as device, Context(device) as context, Buffer(wav) as buffer:
|
||||
|
@ -46,6 +53,7 @@ def test_source_stopped(wav):
|
|||
context.message_handler.source_stopped.assert_called_with(source)
|
||||
|
||||
|
||||
@skipif_travis_macos
|
||||
def test_source_force_stopped(ogg):
|
||||
"""Test the handling of source force stopped message."""
|
||||
with Device() as device, Context(device) as context:
|
||||
|
@ -61,6 +69,7 @@ def test_source_force_stopped(ogg):
|
|||
source.destroy()
|
||||
|
||||
|
||||
@skipif_travis_macos
|
||||
def test_buffer_loading(aiff):
|
||||
"""Test the handling of buffer loading message."""
|
||||
with Device() as device, Context(device) as context:
|
||||
|
|
Loading…
Reference in New Issue