Releases: bossjones/scarlett_os
Threadmanager, pytest, and fixes for mock/monkeypatch leaks.
Feature
threadmanager
This PR is a horrible convoluted set of changes, partially due to a regression in pytest-mock, pytest, and python 3.5.2. More info on the issue can be seen here: https://github.com/bossjones/reproduce_pytest_mock_issue_84
Seeing this issue has really highlighted the need to clean up the structure of the test repo promptly.
In the next PR will work on a top level conftest.py
, and several folders for unit, intgr, performance, behavior, and regression testing. Then we can get rid of a lot of the duplicate code currently being used. From there, we can finally return to adding features to Scarlett.
Main point is, we got threadmanager in, tested it, got rid of a lot of old unittest
code, move more over to pytest, and actually found a way to test some threading based classes.
Reordered-unittest: Splint things into folders based on type of test
Feature
.
βββ AUTHORS.rst
βββ Brewfile
βββ CONTRIBUTING.rst
βββ Dockerfile
βββ Dockerfile-mediagoblin
βββ Gemfile
βββ Gemfile.lock
βββ HISTORY.rst
βββ LICENSE
βββ MANIFEST.in
βββ Makefile
βββ README.rst
βββ _debug
βΒ Β βββ generator-player-pipeline.png
βΒ Β βββ generator-player.dot
βββ assets
βΒ Β βββ generator-listener-pipeline.png
βΒ Β βββ generator-listener.dot
βΒ Β βββ generator-player-pipeline.png
βΒ Β βββ generator-player.dot
βββ ci
βΒ Β βββ build.yml
βΒ Β βββ set_postactivate.sh
βΒ Β βββ travis.sh
βΒ Β βββ travis_bootstrap.sh
βΒ Β βββ travis_debugging.md
βΒ Β βββ travis_jhbuild.yml
βΒ Β βββ travis_source.sh
βββ config
βΒ Β βββ configuration.yaml.example
βΒ Β βββ custom_automations
βΒ Β βΒ Β βββ example.py
βΒ Β βΒ Β βββ hello_world.py
βΒ Β βββ custom_components
βββ container
βΒ Β βββ root
βΒ Β βββ clean.sh
βΒ Β βββ docker_entrypoint.sh
βΒ Β βββ dotfiles
βΒ Β βββ etc
βΒ Β βββ services.d
βΒ Β βββ scarlett_os
βΒ Β βββ finish
βΒ Β βββ run
βββ cookiecutter.json
βββ docker-anaconda.yml
βββ docker-compose-devtools.yml
βββ docker-compose-test-improved.yml
βββ docker-compose.test.yml
βββ docker-compose.yml
βββ docs
βΒ Β βββ Makefile
βΒ Β βββ authors.rst
βΒ Β βββ conf.py
βΒ Β βββ contributing.rst
βΒ Β βββ history.rst
βΒ Β βββ index.rst
βΒ Β βββ installation.rst
βΒ Β βββ make.bat
βΒ Β βββ readme.rst
βΒ Β βββ usage.rst
βββ espeak-1.48.04-source.zip
βββ espeak_tmp.wav
βββ ess.zip
βββ example-cookiecutterrc.yaml
βββ fabfile.py
βββ fs-scarlett.sh
βββ gtk-osx-build-setup.sh
βββ gtk3-venv.sh
βββ keys
βΒ Β βββ vagrant.pub
βΒ Β βββ vagrant_id_rsa
βββ listener.py.diff
βββ osx_virtualenv.sh
βββ pa.tgz
βββ pa_stable_v19_20140130.tgz
βββ postactivate
βββ postactivate_osx
βββ pylintrc
βββ pytestdebug.log
βββ release_checklist.md
βββ requirements.txt
βββ requirements_dev.txt
βββ requirements_test.txt
βββ requirements_test_experimental.txt
βββ scarlett_os
βΒ Β βββ __init__.py
βΒ Β βββ __main__.py
βΒ Β βββ __pycache__
βΒ Β βΒ Β βββ __init__.cpython-35.pyc
βΒ Β βΒ Β βββ commands.cpython-35.pyc
βΒ Β βΒ Β βββ compat.cpython-35.pyc
βΒ Β βΒ Β βββ config.cpython-35.pyc
βΒ Β βΒ Β βββ const.cpython-35.pyc
βΒ Β βΒ Β βββ core.cpython-35.pyc
βΒ Β βΒ Β βββ emitter.cpython-35.pyc
βΒ Β βΒ Β βββ exceptions.cpython-35.pyc
βΒ Β βΒ Β βββ listener.cpython-35.pyc
βΒ Β βΒ Β βββ loader.cpython-35.pyc
βΒ Β βΒ Β βββ mpris.cpython-35.pyc
βΒ Β βΒ Β βββ player.cpython-35.pyc
βΒ Β βΒ Β βββ speaker.cpython-35.pyc
βΒ Β βΒ Β βββ subprocess.cpython-35.pyc
βΒ Β βΒ Β βββ tasker.cpython-35.pyc
βΒ Β βββ automations
βΒ Β βΒ Β βββ __init__.py
βΒ Β βββ commands.py
βΒ Β βββ compat.py
βΒ Β βββ config.py
βΒ Β βββ const.py
βΒ Β βββ core.py
βΒ Β βββ emitter.py
βΒ Β βββ exceptions.py
βΒ Β βββ helpers
βΒ Β βΒ Β βββ __init__.py
βΒ Β βΒ Β βββ __pycache__
βΒ Β βΒ Β βΒ Β βββ __init__.cpython-35.pyc
βΒ Β βΒ Β βΒ Β βββ config_validation.cpython-35.pyc
βΒ Β βΒ Β βΒ Β βββ entity.cpython-35.pyc
βΒ Β βΒ Β βββ config_validation.py
βΒ Β βΒ Β βββ entity.py
βΒ Β βββ internal
βΒ Β βΒ Β βββ __init__.py
βΒ Β βΒ Β βββ __pycache__
βΒ Β βΒ Β βΒ Β βββ __init__.cpython-35.pyc
βΒ Β βΒ Β βΒ Β βββ debugger.cpython-35.pyc
βΒ Β βΒ Β βΒ Β βββ deps.cpython-35.pyc
βΒ Β βΒ Β βΒ Β βββ encoding.cpython-35.pyc
βΒ Β βΒ Β βΒ Β βββ formatting.cpython-35.pyc
βΒ Β βΒ Β βΒ Β βββ gi.cpython-35.pyc
βΒ Β βΒ Β βΒ Β βββ path.cpython-35.pyc
βΒ Β βΒ Β βββ debugger.py
βΒ Β βΒ Β βββ deps.py
βΒ Β βΒ Β βββ encoding.py
βΒ Β βΒ Β βββ formatting.py
βΒ Β βΒ Β βββ gi.py
βΒ Β βΒ Β βββ path.py
βΒ Β βΒ Β βββ system_utils.py
βΒ Β βββ listener.py
βΒ Β βββ loader.py
βΒ Β βββ log.py
βΒ Β βββ logger.py
βΒ Β βββ mpris.py
βΒ Β βββ player.py
βΒ Β βββ receiver.py
βΒ Β βββ scripts
βΒ Β βΒ Β βββ __init__.py
βΒ Β βΒ Β βββ __pycache__
βΒ Β βΒ Β βΒ Β βββ __init__.cpython-35.pyc
βΒ Β βΒ Β βΒ Β βββ cli.cpython-35.pyc
βΒ Β βΒ Β βββ cli.py
βΒ Β βΒ Β βββ config.py
βΒ Β βββ speaker.py
βΒ Β βββ subprocess.py
βΒ Β βββ tasker.py
βΒ Β βββ tools
βΒ Β βΒ Β βββ __init__.py
βΒ Β βΒ Β βββ __pycache__
βΒ Β βΒ Β βΒ Β βββ __init__.cpython-35.pyc
βΒ Β βΒ Β βΒ Β βββ package.cpython-35.pyc
βΒ Β βΒ Β βΒ Β βββ verify.cpython-35.pyc
βΒ Β βΒ Β βββ package.py
βΒ Β βΒ Β βββ verify.py
βΒ Β βββ utility
βΒ Β βββ __init__.py
βΒ Β βββ __pycache__
βΒ Β βΒ Β βββ __init__.cpython-35.pyc
βΒ Β βΒ Β βββ dbus_runner.cpython-35.pyc
βΒ Β βΒ Β βββ dbus_utils.cpython-35.pyc
βΒ Β βΒ Β βββ distance.cpython-35.pyc
βΒ Β βΒ Β βββ dt.cpython-35.pyc
βΒ Β βΒ Β βββ generators.cpython-35.pyc
βΒ Β βΒ Β βββ gnome.cpython-35.pyc
βΒ Β βΒ Β βββ location.cpython-35.pyc
βΒ Β βΒ Β βββ temperature.cpython-35.pyc
βΒ Β βΒ Β βββ thread.cpython-35.pyc
βΒ Β βΒ Β βββ threadmanager.cpython-35.pyc
βΒ Β βΒ Β βββ unit_system.cpython-35.pyc
βΒ Β βΒ Β βββ yaml.cpython-35.pyc
βΒ Β βββ audio.py
βΒ Β βββ dbus_runner.py
βΒ Β βββ dbus_utils.py
βΒ Β βββ distance.py
βΒ Β βββ dt.py
βΒ Β βββ file.py
βΒ Β βββ generators.py
βΒ Β βββ gnome.py
βΒ Β βββ location.py
βΒ Β βββ temperature.py
βΒ Β βββ thread.py
βΒ Β βββ threadmanager.py
βΒ Β βββ unit_system.py
βΒ Β βββ yaml.py
βββ scarlett_os.sublime-project
βββ scarlett_os_notes.md
βββ scripts
βΒ Β βββ docker
βΒ Β βΒ Β βββ exec-master
βΒ Β βββ fix_pulse.sh
βΒ Β βββ generate_sublime3_anaconda_config.sh
βΒ Β βββ install_openssl_and_py_cryptography.sh
βΒ Β βββ lint
βΒ Β βββ mainloop_terminate_ctrl_c.py
βΒ Β βββ pdbrc
βΒ Β βββ pdbrc.py
βΒ Β βββ remove_non_utf8.sh
βββ setup.cfg
βββ setup.py
βββ src
βΒ Β βββ pip-delete-this-directory.txt
βΒ Β βββ pytest-flakefinder
βΒ Β βββ CHANGELOG.md
βΒ Β βββ LICENSE
βΒ Β βββ MANIFEST.in
βΒ Β βββ README.rst
βΒ Β βββ docs
βΒ Β βΒ Β βββ index.md
βΒ Β βββ mkdocs.yml
βΒ Β βββ pytest_flakefinder.py
βΒ Β βββ setup.cfg
βΒ Β βββ setup.py
βΒ Β βββ tests
βΒ Β βΒ Β βββ conftest.py
βΒ Β βΒ Β βββ test_flakefinder.py
βΒ Β βββ tox.ini
βββ static
βΒ Β βββ noise.prof
βΒ Β βββ sounds
βΒ Β βΒ Β βββ pi-cancel.2.wav
βΒ Β βΒ Β βββ pi-cancel.wav
βΒ Β βΒ Β βββ pi-listening.2.wav
βΒ Β βΒ Β βββ pi-listening.wav
βΒ Β βΒ Β βββ pi-loading.wav
βΒ Β βΒ Β βββ pi-response.wav
βΒ Β βΒ Β βββ pi-response2.wav
βΒ Β βββ speech
βΒ Β βββ corpus
βΒ Β βΒ Β βββ scarlett.corpus
βΒ Β βββ dict
βΒ Β βΒ Β βββ 0104.dic
βΒ Β βΒ Β βββ 1473.dic
βΒ Β βΒ Β βββ 1602.dic
βΒ Β βΒ Β βββ 6404.dic
βΒ Β βΒ Β βββ 7219.dic
βΒ Β βΒ Β βββ 7254.dic
βΒ Β βΒ Β βββ 7597.dic
βΒ Β βΒ Β βββ 7840.dic
βΒ Β βββ grammer
βΒ Β βΒ Β βββ scarlett.jsgf
βΒ Β βββ hmm
βΒ Β βΒ Β βββ en_US
βΒ Β βΒ Β βββ hub4wsj_sc_8k
βΒ Β βΒ Β βββ feat.params
βΒ Β βΒ Β βββ mdef
βΒ Β βΒ Β βββ means
βΒ Β βΒ Β βββ noisedict
βΒ Β βΒ Β βββ sendump
βΒ Β βΒ Β βββ transition_matrices
βΒ Β βΒ Β βββ variances
βΒ Β βββ http
βΒ Β βΒ Β βββ hue_api_lights_resp.json
βΒ Β βββ lm
βΒ Β βΒ Β βββ 0104.lm
βΒ Β βΒ Β βββ 1473.lm
βΒ Β βΒ Β βββ 1602.lm
βΒ Β βΒ Β βββ 6404.lm
βΒ Β βΒ Β βββ 7219.lm
βΒ Β βΒ Β βββ 7254.lm
βΒ Β βΒ Β βββ 7597.lm
βΒ Β βΒ Β βββ 7840.lm
βΒ Β βββ mp4
βΒ Β βΒ Β βββ turn_lights_red.mp4
βΒ Β βΒ Β βββ turn_on_the_lights.mp4
βΒ Β βΒ Β βββ whats_the_weather.mp4
βΒ Β βββ vocab
βΒ Β βΒ Β βββ 0104.vocab
βΒ Β βΒ Β βββ 1602.vocab
βΒ Β βΒ Β βββ 7219.vocab
βΒ Β βΒ Β βββ 7254.vocab
βΒ Β βΒ Β βββ 7597.vocab
βΒ Β βΒ Β βββ 7840.vocab
βΒ Β βββ wav
βΒ Β βββ turn_lights_red.wav
βββ tests
βΒ Β βββ __init__.py
βΒ Β βββ __pycache__
βΒ Β βΒ Β βββ __init__.cpython-35.pyc
βΒ Β βΒ Β βββ common.cpython-35.pyc
βΒ Β βΒ Β βββ conftest.cpython-35-PYTEST.pyc
βΒ Β βββ common.py
βΒ Β βββ common_integration.py
βΒ Β βββ conftest.py
βΒ Β βββ data
βΒ Β βΒ Β βββ samples
βΒ Β βΒ Β βββ fixture_scarlett-riff-little-endian-16bit-16kh-wave-file.wav
βΒ Β βΒ Β βββ fixture_turn_lights_red-riff-little-endian-16bit-16kh-wave-file.wav
βΒ Β βΒ Β βββ fixture_what_time_is_it-riff-little-endian-16bit-16kh-wave-file.wav
βΒ Β βββ integrationtests
βΒ Β βΒ Β βββ README.md
βΒ Β βΒ Β βββ __init__.py
βΒ Β βΒ Β βββ __pycache__
βΒ Β βΒ Β βΒ Β βββ __init__.cpython-35.pyc
βΒ Β βΒ Β βΒ Β βββ baseclass.cpython-35.pyc
βΒ Β βΒ Β βΒ Β βββ conftest.cpython-35-PYTEST.pyc
βΒ Β βΒ Β βΒ Β βββ stubs.cpython-35.pyc
βΒ Β βΒ Β βΒ Β βββ test_integration_end_to_end.cpython-35-PYTEST.pyc
βΒ Β βΒ Β βΒ Β βββ test_integration_listener.cpython-35-PYTEST.pyc
βΒ Β βΒ Β βΒ Β βββ test_integration_mpris.cpython-35-PYTEST.pyc
βΒ Β βΒ Β βΒ Β βββ test_integration_player.cpython-35-PYTEST.pyc
βΒ Β βΒ Β βΒ Β βββ test_integration_tasker.cpython-35-PYTEST.pyc
βΒ Β βΒ Β βΒ Β βββ test_integration_threadmanager.cpython-35-PYTEST.pyc
βΒ Β βΒ Β βββ baseclass.py
βΒ Β βΒ Β βββ stubs.py
βΒ Β βΒ Β βββ test_integration_end_to_end.py
βΒ Β βΒ Β βββ test_integration_listener.py
βΒ Β βΒ Β βββ test_integration_mpris.py
βΒ Β βΒ Β βββ test_integration_player.py
βΒ Β βΒ Β βββ test_integration_tasker.py
βΒ Β βΒ Β βββ test_integration_tasker.py.enable_sound.diff
βΒ Β βΒ Β βββ test_integration_threadmanager.py
βΒ Β βββ performancetests
βΒ Β βΒ Β βββ __init__.py
βΒ Β βΒ Β βββ baseclass.py
βΒ Β βββ run_all_tests
βΒ Β βββ run_dbus_tests.sh
βΒ Β βββ testing_config
βΒ Β βΒ Β βββ custom_automations
βΒ Β βΒ Β βββ light
βΒ Β βΒ Β βΒ Β βββ test.py
βΒ Β βΒ Β βββ switch
βΒ Β βΒ Β βββ test.py
βΒ Β βββ tools_common.py
βΒ Β βββ unit_scarlett_os.py
βΒ Β βββ unittests
βΒ Β βββ __init__.py
βΒ Β βββ __pycache__
βΒ Β βΒ Β βββ __init__.cpython-35.pyc
βΒ Β βΒ Β βββ test_cli.cpython-35-PYTEST.pyc
βΒ Β βΒ Β βββ test_commands.cpython-35-PYTEST.pyc
βΒ Β βΒ Β βββ test_listener.cpython-35-PYTEST.pyc
βΒ Β βΒ Β βββ test_mpris.cpython-35-PYTEST.pyc
βΒ Β βΒ Β βββ test_player.cpython-35-PYTEST.pyc
βΒ Β βΒ Β βββ test_scarlett_os.cpython-35-PYTEST.pyc
βΒ Β βΒ Β βββ test_speaker.cpython-35-PYTEST.pyc
βΒ Β βΒ Β βββ test_subprocess.cpython-35-PYTEST.pyc
βΒ Β βΒ Β βββ test_tasker.cpython-35-PYTEST.pyc
βΒ Β βΒ Β βββ test_threadmanager.cpython-35-PYTEST.pyc
βΒ Β β...
Initial Integration testing via pytest
Features
- Integration testing
- Dbus session service per Integration test, keeps things isolated and allows us to test signals/methods
- Fixes to DEBUG environment variables
- Slight refactoring to dbus calls
- Attempting to delete more code we don't use
- Better usage of pdb
Note from PR being closed
We still haven't 100% gotten to the real solid refactor work. This sprint ended up being related to integration testing since I started introducing regressions into scarlett's code by making simple changes. Going forward I want to add more to the end-to-end testing suite to make sure we really capture all things that happen and report back correctly when things are wrong, but this is a good starting point.
Main things we added, individual dbus instances per test via pytest fixtures. Allows us to interact directly with an isolated instance of dbus per test. It is very difficult to mock out the entire pydbus class, so this gives us some degree of integration between services.
Also added a new class that can be used by Scarlett service to interact with dbus directly. Will need to go through and fix up her code / get ride of repeating code.
Still pushing for a SOLID refactor, but will continue to take time as I wrap my head around concepts and get exposed to some of the better code out there. Merging.
TL;DR - There is still a lot of ugly things I'm doing, but I'm learning a shit ton in the process, and it will all pay off in the end.