Skip to content
This repository has been archived by the owner on Jun 19, 2022. It is now read-only.

Commit

Permalink
Merge pull request #47 from bossjones/feature-threadmanager-testing
Browse files Browse the repository at this point in the history
WIP: threadingmanager tests
  • Loading branch information
bossjones authored May 21, 2017
2 parents 015af56 + d1e39eb commit cfe2cb4
Show file tree
Hide file tree
Showing 63 changed files with 2,982 additions and 1,291 deletions.
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,7 @@ __pycache__/
*.~

Procfile*

_debug/
espeak_tmp.wav
.coverage.*
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,12 @@ sphinxbase
*.DS_Store
*.DS_Store*
listener.py.diff

# source: https://www.sublimetext.com/docs/3/projects.html
*.sublime-workspace
.sublime-workspace

_debug/
espeak_tmp.wav
.vscode/tags
src/
2 changes: 1 addition & 1 deletion .pylintrc_scarlett_os
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ comment=no
[FORMAT]

# Maximum number of characters on a single line.
max-line-length=80
max-line-length=200

# Maximum number of lines in a module
max-module-lines=1000
Expand Down
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ before_install:
cache:
apt: true
directories:
# - "$HOME/.cache/pip"
# - "$HOME/virtualenv/python3.5.2/lib/python3.5/site-packages"
- "$HOME/.ccache"
- "$HOME/jhbuild"
- "$HOME/gnome"
Expand Down
43 changes: 43 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// Place your settings in this file to overwrite default and user settings.
{
"editor.renderWhitespace": "all",
"workbench.iconTheme": "vs-seti",

"files.exclude": {
"out": false, // set this to true to hide the "out" folder with the compiled JS files
"**/*.pyc": true,
"**/__pycache__": true,
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/.DS_Store": true
},
"files.trimTrailingWhitespace": true,
"search.exclude": {
"**/node_modules": true,
"**/bower_components": true,
"**/.vscode/tags": true,
"**/.vendor": true,
"**/build": true
},
"python.pythonPath": "/Users/malcolm/.virtualenvs/scarlett-os-venv2/bin/python3",
"python.formatting.provider": "autopep8",
"python.linting.ignorePatterns": [
".vscode/*.py",
"**/site-packages/**/*.py"
],
"python.venvPath": "~/.virtualenvs",
"python.sortImports.path": "/Users/malcolm/.virtualenvs/scarlett-os-venv2/bin/isort",
"python.autoComplete.extraPaths": [
""
// /usr/local/Cellar/gst-python/1.6.2/lib/python2.7/site-packages
// "/Users/malcolm/dev/gnome/pygobject-3.18.2"
// "/usr/local/Cellar/pygobject3/3.18.2/lib/python2.7/site-packages"
// "/usr/local/Cellar/cmu-sphinxbase/HEAD/lib/python2.7/site-packages"
// "/usr/local/Cellar/cmu-pocketsphinx/HEAD/lib/python2.7/site-packages"
// "/Users/malcolm/dev/gnome/pydbus-v0.5.1"

],
"terminal.integrated.shellArgs.osx": ["-l"],
"terminal.integrated.shellArgs.linux": ["-l"]
}
15 changes: 13 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ COPY ./ /home/pi/dev/bossjones-github/scarlett_os
WORKDIR /home/pi/dev/bossjones-github/scarlett_os

RUN sudo apt-get update -yqq && \
sudo apt-get install dbus dbus-x11 psmisc vim xvfb xclip -yqq && \
sudo apt-get install dbus dbus-x11 psmisc vim xvfb xclip htop -yqq && \
sudo apt-get clean && \
sudo apt-get autoclean -y && \
sudo apt-get autoremove -y && \
Expand All @@ -21,12 +21,23 @@ RUN set -x cd /home/pi/dev/bossjones-github/scarlett_os \

COPY ./container/root /

# Install stuff required for Sublime3 remote dev
RUN sudo mv -f /dotfiles/.pythonrc /home/pi/.pythonrc && \
sudo chown pi:pi /home/pi/.pythonrc && \
sudo mv -f /dotfiles/.pdbrc /home/pi/.pdbrc && \
sudo chown pi:pi /home/pi/.pdbrc && \
sudo mv -f /dotfiles/.pdbrc.py /home/pi/.pdbrc.py && \
sudo chown pi:pi /home/pi/.pdbrc.py
sudo chown pi:pi /home/pi/.pdbrc.py && \
echo "****************[PTPYTHON]****************" && \
sudo mkdir -p /home/pi/.ptpython && \
sudo mv -f /dotfiles/.ptpython_config.py /home/pi/.ptpython/config.py && \
sudo chown pi:pi /home/pi/.ptpython && \
echo "****************[SUBLIME-ANACONDA]****************" && \
sudo chown pi:pi -R /opt/ && \
cd /opt/ && \
git clone https://github.com/DamnWidget/anaconda.git && \
cd anaconda && \
git checkout 223cc612b0318262535ac488d1f4b4121c2e8f0d

ENTRYPOINT ["/docker_entrypoint.sh"]
CMD true
141 changes: 140 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,51 @@ endef
export PRINT_HELP_PYSCRIPT
BROWSER := python -c "$$BROWSER_PYSCRIPT"


define ASCILOGO
██████ ▄████▄ ▄▄▄ ██▀███ ██▓ ▓█████▄▄▄█████▓▄▄▄█████▓ ███▄ ▄███▓ ▄▄▄ ██ ▄█▀▓█████
▒██ ▒ ▒██▀ ▀█ ▒████▄ ▓██ ▒ ██▒▓██▒ ▓█ ▀▓ ██▒ ▓▒▓ ██▒ ▓▒ ▓██▒▀█▀ ██▒▒████▄ ██▄█▒ ▓█ ▀
░ ▓██▄ ▒▓█ ▄ ▒██ ▀█▄ ▓██ ░▄█ ▒▒██░ ▒███ ▒ ▓██░ ▒░▒ ▓██░ ▒░ ▓██ ▓██░▒██ ▀█▄ ▓███▄░ ▒███
▒ ██▒▒▓▓▄ ▄██▒░██▄▄▄▄██ ▒██▀▀█▄ ▒██░ ▒▓█ ▄░ ▓██▓ ░ ░ ▓██▓ ░ ▒██ ▒██ ░██▄▄▄▄██ ▓██ █▄ ▒▓█ ▄
▒██████▒▒▒ ▓███▀ ░ ▓█ ▓██▒░██▓ ▒██▒░██████▒░▒████▒ ▒██▒ ░ ▒██▒ ░ ▒██▒ ░██▒ ▓█ ▓██▒▒██▒ █▄░▒████▒
▒ ▒▓▒ ▒ ░░ ░▒ ▒ ░ ▒▒ ▓▒█░░ ▒▓ ░▒▓░░ ▒░▓ ░░░ ▒░ ░ ▒ ░░ ▒ ░░ ░ ▒░ ░ ░ ▒▒ ▓▒█░▒ ▒▒ ▓▒░░ ▒░ ░
░ ░▒ ░ ░ ░ ▒ ▒ ▒▒ ░ ░▒ ░ ▒░░ ░ ▒ ░ ░ ░ ░ ░ ░ ░ ░ ░ ▒ ▒▒ ░░ ░▒ ▒░ ░ ░ ░
░ ░ ░ ░ ░ ▒ ░░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ▒ ░ ░░ ░ ░
░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░░ ░ ░ ░
=======================================
endef

export ASCILOGO

# http://misc.flogisoft.com/bash/tip_colors_and_formatting

RED=\033[0;31m
GREEN=\033[0;32m
ORNG=\033[38;5;214m
BLUE=\033[38;5;81m
NC=\033[0m

export RED
export GREEN
export NC
export ORNG
export BLUE

# # verify that certain variables have been defined off the bat
# check_defined = \
# $(foreach 1,$1,$(__check_defined))
# __check_defined = \
# $(if $(value $1),, \
# $(error Undefined $1$(if $(value 2), ($(strip $2)))))

# list_allowed_args := product

help:
@printf "\033[1m$$ASCILOGO $$NC\n"
@printf "\033[21m\n\n"
@printf "=======================================\n"
@printf "\n"
@python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)

list:
Expand All @@ -49,13 +93,17 @@ clean: clean-build clean-pyc clean-test ## remove all build, test, coverage and

.PHONY: bootstrap
bootstrap:
[ "$$VIRTUAL_ENV" != "" ]
# [ "$$VIRTUAL_ENV" != "" ]
rm -rf *.egg-info || true
pip install -r requirements.txt
pip install -r requirements_dev.txt
python setup.py install
pip install -e .[test]

.PHONY: bootstrap-experimental
bootstrap-experimental:
pip install -r requirements_test_experimental.txt

clean-build: ## remove build artifacts
rm -fr build/
rm -fr dist/
Expand Down Expand Up @@ -130,18 +178,63 @@ test-travis:
$(pytest) $(test_args_no_xml) --benchmark-skip
coverage report -m

.PHONY: test-travis-scarlettonly
test-travis-scarlettonly: export TRAVIS_CI=1
test-travis-scarlettonly:
$(pytest) $(test_args_no_xml) --benchmark-skip -m scarlettonly
coverage report -m

.PHONY: test-travis-scarlettonlyintgr
test-travis-scarlettonlyintgr: export TRAVIS_CI=1
test-travis-scarlettonlyintgr:
$(pytest) $(test_args_no_xml) --benchmark-skip -m scarlettonlyintgr
coverage report -m

.PHONY: test-travis-scarlettonlyintgr-no-timeout
test-travis-scarlettonlyintgr-no-timeout: export TRAVIS_CI=1
test-travis-scarlettonlyintgr-no-timeout:
$(pytest) $(test_args_no_xml) --benchmark-skip -m scarlettonlyintgr -p no:timeout
coverage report -m

.PHONY: test-travis-scarlettonlyunittest
test-travis-scarlettonlyunittest: export TRAVIS_CI=1
test-travis-scarlettonlyunittest:
$(pytest) $(test_args_no_xml) --benchmark-skip -m scarlettonlyunittest
coverage report -m

.PHONY: test-travis-unittest
test-travis-unittest: export TRAVIS_CI=1
test-travis-unittest:
$(pytest) $(test_args_no_xml) --benchmark-skip -m unittest
coverage report -m

.PHONY: test-travis-debug
test-travis-debug:
$(pytest) $(test_args_no_xml) --benchmark-skip --pdb --showlocals
coverage report -m

.PHONY: test-travis-leaks
test-travis-leaks: export TRAVIS_CI=1
test-travis-leaks:
$(pytest) $(test_args_no_xml) --benchmark-skip -R :
coverage report -m

.PHONY: cover
cover:
$(pytest) $(cover_args) --benchmark-skip
coverage report -m
coverage html
$(BROWSER) htmlcov/index.html

.PHONY: cover-travisci
cover-travisci: export TRAVIS_CI=1
cover-travisci: display-env
# $(pytest) $(cover_args) --benchmark-skip -p no:ipdb
pytest -p no:ipdb -p no:pytestipdb -s --tb short --cov-config .coveragerc --cov scarlett_os tests --cov-report html --benchmark-skip --showlocals --trace-config
coverage report -m
coverage html
$(BROWSER) htmlcov/index.html

.PHONY: cover-debug
cover-debug:
# --showlocals # show local variables in tracebacks
Expand All @@ -157,6 +250,21 @@ cover-debug-no-timeout:
coverage html
$(BROWSER) htmlcov/index.html

.PHONY: display-env
display-env:
@printf "=======================================\n"
@printf "$$GREEN TRAVIS_CI:$$NC $(TRAVIS_CI) \n"
@printf "=======================================\n"

# This task simulates a travis environment
.PHONY: cover-debug-no-timeout-travisci
cover-debug-no-timeout-travisci: export TRAVIS_CI=1
cover-debug-no-timeout-travisci: display-env
pytest -p no:timeout -s --tb short --cov-config .coveragerc --cov scarlett_os tests --cov-report html --benchmark-skip --pdb --showlocals
coverage report -m
coverage html
$(BROWSER) htmlcov/index.html

.PHONY: shell
shell:
ipython
Expand Down Expand Up @@ -256,3 +364,34 @@ create-docker-machine:
--engine-install-url "https://test.docker.com" \
scarlett-1604-packer
eval $(docker-machine env scarlett-1604-packer)

docker-compose-build:
@docker-compose -f docker-compose-devtools.yml build

docker-compose-build-master:
@docker-compose -f docker-compose-devtools.yml build master

docker-compose-run-master:
@docker-compose -f docker-compose-devtools.yml run --name scarlett_master --rm master bash

docker-compose-run-test:
@docker-compose -f docker-compose-devtools.yml run --name scarlett_test --rm test bash python3 --version

docker-compose-up:
@docker-compose -f docker-compose-devtools.yml up

docker-compose-up-build:
@docker-compose -f docker-compose-devtools.yml up --build

docker-compose-down:
@docker-compose -f docker-compose-devtools.yml down

docker-version:
@docker --version
@docker-compose --version

docker-exec:
@scripts/docker/exec-master

docker-exec-master:
@scripts/docker/exec-master
2 changes: 2 additions & 0 deletions container/root/docker_entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ dbus-daemon --session --print-address=0 --print-pid=1 --fork 0>"$ADDRESS_FILE" 1
export DBUS_SESSION_BUS_ADDRESS=$(cat "$ADDRESS_FILE")
PID=$(cat "$PID_FILE")

echo "export DBUS_SESSION_BUS_ADDRESS=$(cat "$ADDRESS_FILE")" > ~pi/.exports

echo "D-Bus per-session daemon address is: $DBUS_SESSION_BUS_ADDRESS"

trap 'kill -TERM $PID' EXIT
Expand Down
Loading

0 comments on commit cfe2cb4

Please sign in to comment.