diff --git a/.circleci/config.yml b/.circleci/config.yml index e933d78..aafd35c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -26,8 +26,8 @@ jobs: name: run tests command: | . venv/bin/activate - make lint - make test + flake8 + pytest - run: name: report coverage command: | diff --git a/.flake8 b/.flake8 new file mode 100644 index 0000000..25aa459 --- /dev/null +++ b/.flake8 @@ -0,0 +1,2 @@ +[flake8] +exclude=.venv,venv,snowboy,build diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..14cb7d7 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,61 @@ +# Changelog + +## 1.4.1 +[Full Changelog](https://github.com/richtier/alexa-voice-service-client/pull/34) +### Implemented enhancements +- Simplified makefile. Use direct `flake8` and `pytest` commands instead of `make lint` and `make test`. +- Add CHANGELOG.md + +### Fixed bugs +- Fixed synchronise state incorrectly using `GET` method. + +## 1.4.0 +[Full Changelog](https://github.com/richtier/alexa-voice-service-client/pull/33) +### Implemented enhancements +- Add Automatic Speech Recognition (ASR) profile support, optimized for user speech from varying distances. + +## 1.3.0 +[Full Changelog](https://github.com/richtier/alexa-voice-service-client/pull/31) +### Implemented enhancements +- Renamed package from avs_client to alexa_client +- Use thread timer for ping management +- Add ExpectSpeech directive + +## 1.2.0 +[Full Changelog](https://github.com/richtier/alexa-voice-service-client/pull/29) +### Implemented enhancements +- Support dialogue request id to support multi-step commands. +- Added streaming audio example + +### Fixed bugs + +## 1.1.0 +[Full Changelog](https://github.com/richtier/alexa-voice-service-client/pull/28) +### Implemented enhancements +- Added support for HandlePlay directive + +## 1.0.0 +[Full Changelog](https://github.com/richtier/alexa-voice-service-client/pull/23) +### Implemented enhancements +- Handle multi-part responses +- Removed type hinting +- Added makefile + +## 0.7.1 +[Full Changelog](https://github.com/richtier/alexa-voice-service-client/pull/16) +### Implemented enhancements +- Remove requirements.txt - hard-code in setup.py instead + +### Fixed bugs +- Fix incorrect callback url generation #16 + +## 0.6.0 +[Full Changelog](https://github.com/richtier/alexa-voice-service-client/pull/12) +### Implemented enhancements +- Add AmazonOauth2RequestManager + +## 0.5.2 +[Full Changelog](https://github.com/richtier/alexa-voice-service-client/pull/6) + +### Fixed bugs +- Expect 204 or 200 on synchronise device state diff --git a/Makefile b/Makefile index c8f4620..563fddb 100644 --- a/Makefile +++ b/Makefile @@ -22,19 +22,4 @@ test_requirements: pip install -e .[test] -lint: - flake8 --exclude=.venv,venv,snowboy,build - - -test: - pytest $1 \ - --ignore=venv \ - --ignore=.venv \ - --ignore=build \ - --cov=./ \ - --cov-config=.coveragerc \ - --capture=no \ - --last-failed \ - -vv - -.PHONY: build publish_test publish test_requirements test +.PHONY: build publish_test publish test_requirements diff --git a/README.md b/README.md index 6f521f8..d3d1fd7 100644 --- a/README.md +++ b/README.md @@ -196,7 +196,7 @@ To run the unit tests, call the following commands: ```sh git clone git@github.com:richtier/alexa-voice-service-client.git make test_requirements -make test +pytest ``` ## Other projects ## diff --git a/alexa_client/alexa_client/connection.py b/alexa_client/alexa_client/connection.py index ce84c40..0496d0a 100644 --- a/alexa_client/alexa_client/connection.py +++ b/alexa_client/alexa_client/connection.py @@ -65,13 +65,13 @@ def synchronise_device_state(self, device_state, authentication_headers): 'Content-Type': multipart_data.content_type } stream_id = self.connection.request( - 'GET', + 'POST', '/v20160207/events', body=multipart_data, headers=headers, ) response = self.connection.get_response(stream_id) - assert response.status in [http.client.NO_CONTENT, http.client.OK] + assert response.status == http.client.NO_CONTENT def send_audio_file( self, audio_file, device_state, authentication_headers, diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 0000000..531978e --- /dev/null +++ b/pytest.ini @@ -0,0 +1,2 @@ +[pytest] +addopts= --ignore=venv --ignore=.venv --ignore=build --cov=./ --cov-config=.coveragerc --capture=no --last-failed -vv diff --git a/setup.py b/setup.py index 6c33252..0de568a 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ setup( name='alexa_client', - version='1.4.0', + version='1.4.1', packages=find_packages(exclude=["tests.*", "tests"]), url='https://github.com/richtier/alexa-voice-service-client', license='MIT', diff --git a/tests/alexa_client/test_connection.py b/tests/alexa_client/test_connection.py index f566dd2..171e54c 100644 --- a/tests/alexa_client/test_connection.py +++ b/tests/alexa_client/test_connection.py @@ -81,12 +81,11 @@ def test_establish_downstream_conncetion(manager, authentication_headers): } -@pytest.mark.parametrize("status", [200, 204]) def test_synchronise_device_state( - status, manager, authentication_headers, device_state + manager, authentication_headers, device_state ): manager.create_connection() - manager.mock_response(status_code=status) + manager.mock_response(status_code=204) manager.synchronise_device_state( authentication_headers=authentication_headers, @@ -96,7 +95,7 @@ def test_synchronise_device_state( headers = dict(list(manager.connection.recent_stream.headers.items())) assert headers == { - b':method': b'GET', + b':method': b'POST', b':scheme': b'https', b':authority': b'avs-alexa-eu.amazon.com', b':path': b'/v20160207/events',