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

Commit cfe2cb4

Browse files
authored
Merge pull request #47 from bossjones/feature-threadmanager-testing
WIP: threadingmanager tests
2 parents 015af56 + d1e39eb commit cfe2cb4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+2982
-1291
lines changed

.dockerignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,7 @@ __pycache__/
3737
*.~
3838

3939
Procfile*
40+
41+
_debug/
42+
espeak_tmp.wav
43+
.coverage.*

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,12 @@ sphinxbase
8080
*.DS_Store
8181
*.DS_Store*
8282
listener.py.diff
83+
84+
# source: https://www.sublimetext.com/docs/3/projects.html
85+
*.sublime-workspace
86+
.sublime-workspace
87+
88+
_debug/
89+
espeak_tmp.wav
90+
.vscode/tags
91+
src/

.pylintrc_scarlett_os

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ comment=no
6767
[FORMAT]
6868

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

7272
# Maximum number of lines in a module
7373
max-module-lines=1000

.travis.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ before_install:
3232
cache:
3333
apt: true
3434
directories:
35-
# - "$HOME/.cache/pip"
36-
# - "$HOME/virtualenv/python3.5.2/lib/python3.5/site-packages"
3735
- "$HOME/.ccache"
3836
- "$HOME/jhbuild"
3937
- "$HOME/gnome"

.vscode/settings.json

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// Place your settings in this file to overwrite default and user settings.
2+
{
3+
"editor.renderWhitespace": "all",
4+
"workbench.iconTheme": "vs-seti",
5+
6+
"files.exclude": {
7+
"out": false, // set this to true to hide the "out" folder with the compiled JS files
8+
"**/*.pyc": true,
9+
"**/__pycache__": true,
10+
"**/.git": true,
11+
"**/.svn": true,
12+
"**/.hg": true,
13+
"**/.DS_Store": true
14+
},
15+
"files.trimTrailingWhitespace": true,
16+
"search.exclude": {
17+
"**/node_modules": true,
18+
"**/bower_components": true,
19+
"**/.vscode/tags": true,
20+
"**/.vendor": true,
21+
"**/build": true
22+
},
23+
"python.pythonPath": "/Users/malcolm/.virtualenvs/scarlett-os-venv2/bin/python3",
24+
"python.formatting.provider": "autopep8",
25+
"python.linting.ignorePatterns": [
26+
".vscode/*.py",
27+
"**/site-packages/**/*.py"
28+
],
29+
"python.venvPath": "~/.virtualenvs",
30+
"python.sortImports.path": "/Users/malcolm/.virtualenvs/scarlett-os-venv2/bin/isort",
31+
"python.autoComplete.extraPaths": [
32+
""
33+
// /usr/local/Cellar/gst-python/1.6.2/lib/python2.7/site-packages
34+
// "/Users/malcolm/dev/gnome/pygobject-3.18.2"
35+
// "/usr/local/Cellar/pygobject3/3.18.2/lib/python2.7/site-packages"
36+
// "/usr/local/Cellar/cmu-sphinxbase/HEAD/lib/python2.7/site-packages"
37+
// "/usr/local/Cellar/cmu-pocketsphinx/HEAD/lib/python2.7/site-packages"
38+
// "/Users/malcolm/dev/gnome/pydbus-v0.5.1"
39+
40+
],
41+
"terminal.integrated.shellArgs.osx": ["-l"],
42+
"terminal.integrated.shellArgs.linux": ["-l"]
43+
}

Dockerfile

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ COPY ./ /home/pi/dev/bossjones-github/scarlett_os
66
WORKDIR /home/pi/dev/bossjones-github/scarlett_os
77

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

2222
COPY ./container/root /
2323

24+
# Install stuff required for Sublime3 remote dev
2425
RUN sudo mv -f /dotfiles/.pythonrc /home/pi/.pythonrc && \
2526
sudo chown pi:pi /home/pi/.pythonrc && \
2627
sudo mv -f /dotfiles/.pdbrc /home/pi/.pdbrc && \
2728
sudo chown pi:pi /home/pi/.pdbrc && \
2829
sudo mv -f /dotfiles/.pdbrc.py /home/pi/.pdbrc.py && \
29-
sudo chown pi:pi /home/pi/.pdbrc.py
30+
sudo chown pi:pi /home/pi/.pdbrc.py && \
31+
echo "****************[PTPYTHON]****************" && \
32+
sudo mkdir -p /home/pi/.ptpython && \
33+
sudo mv -f /dotfiles/.ptpython_config.py /home/pi/.ptpython/config.py && \
34+
sudo chown pi:pi /home/pi/.ptpython && \
35+
echo "****************[SUBLIME-ANACONDA]****************" && \
36+
sudo chown pi:pi -R /opt/ && \
37+
cd /opt/ && \
38+
git clone https://github.com/DamnWidget/anaconda.git && \
39+
cd anaconda && \
40+
git checkout 223cc612b0318262535ac488d1f4b4121c2e8f0d
3041

3142
ENTRYPOINT ["/docker_entrypoint.sh"]
3243
CMD true

Makefile

Lines changed: 140 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,51 @@ endef
3939
export PRINT_HELP_PYSCRIPT
4040
BROWSER := python -c "$$BROWSER_PYSCRIPT"
4141

42+
43+
define ASCILOGO
44+
██████ ▄████▄ ▄▄▄ ██▀███ ██▓ ▓█████▄▄▄█████▓▄▄▄█████▓ ███▄ ▄███▓ ▄▄▄ ██ ▄█▀▓█████
45+
▒██ ▒ ▒██▀ ▀█ ▒████▄ ▓██ ▒ ██▒▓██▒ ▓█ ▀▓ ██▒ ▓▒▓ ██▒ ▓▒ ▓██▒▀█▀ ██▒▒████▄ ██▄█▒ ▓█ ▀
46+
░ ▓██▄ ▒▓█ ▄ ▒██ ▀█▄ ▓██ ░▄█ ▒▒██░ ▒███ ▒ ▓██░ ▒░▒ ▓██░ ▒░ ▓██ ▓██░▒██ ▀█▄ ▓███▄░ ▒███
47+
▒ ██▒▒▓▓▄ ▄██▒░██▄▄▄▄██ ▒██▀▀█▄ ▒██░ ▒▓█ ▄░ ▓██▓ ░ ░ ▓██▓ ░ ▒██ ▒██ ░██▄▄▄▄██ ▓██ █▄ ▒▓█ ▄
48+
▒██████▒▒▒ ▓███▀ ░ ▓█ ▓██▒░██▓ ▒██▒░██████▒░▒████▒ ▒██▒ ░ ▒██▒ ░ ▒██▒ ░██▒ ▓█ ▓██▒▒██▒ █▄░▒████▒
49+
▒ ▒▓▒ ▒ ░░ ░▒ ▒ ░ ▒▒ ▓▒█░░ ▒▓ ░▒▓░░ ▒░▓ ░░░ ▒░ ░ ▒ ░░ ▒ ░░ ░ ▒░ ░ ░ ▒▒ ▓▒█░▒ ▒▒ ▓▒░░ ▒░ ░
50+
░ ░▒ ░ ░ ░ ▒ ▒ ▒▒ ░ ░▒ ░ ▒░░ ░ ▒ ░ ░ ░ ░ ░ ░ ░ ░ ░ ▒ ▒▒ ░░ ░▒ ▒░ ░ ░ ░
51+
░ ░ ░ ░ ░ ▒ ░░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ▒ ░ ░░ ░ ░
52+
░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░░ ░ ░ ░
53+
54+
=======================================
55+
endef
56+
57+
export ASCILOGO
58+
59+
# http://misc.flogisoft.com/bash/tip_colors_and_formatting
60+
61+
RED=\033[0;31m
62+
GREEN=\033[0;32m
63+
ORNG=\033[38;5;214m
64+
BLUE=\033[38;5;81m
65+
NC=\033[0m
66+
67+
export RED
68+
export GREEN
69+
export NC
70+
export ORNG
71+
export BLUE
72+
73+
# # verify that certain variables have been defined off the bat
74+
# check_defined = \
75+
# $(foreach 1,$1,$(__check_defined))
76+
# __check_defined = \
77+
# $(if $(value $1),, \
78+
# $(error Undefined $1$(if $(value 2), ($(strip $2)))))
79+
80+
# list_allowed_args := product
81+
4282
help:
83+
@printf "\033[1m$$ASCILOGO $$NC\n"
84+
@printf "\033[21m\n\n"
85+
@printf "=======================================\n"
86+
@printf "\n"
4387
@python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)
4488

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

5094
.PHONY: bootstrap
5195
bootstrap:
52-
[ "$$VIRTUAL_ENV" != "" ]
96+
# [ "$$VIRTUAL_ENV" != "" ]
5397
rm -rf *.egg-info || true
5498
pip install -r requirements.txt
5599
pip install -r requirements_dev.txt
56100
python setup.py install
57101
pip install -e .[test]
58102

103+
.PHONY: bootstrap-experimental
104+
bootstrap-experimental:
105+
pip install -r requirements_test_experimental.txt
106+
59107
clean-build: ## remove build artifacts
60108
rm -fr build/
61109
rm -fr dist/
@@ -130,18 +178,63 @@ test-travis:
130178
$(pytest) $(test_args_no_xml) --benchmark-skip
131179
coverage report -m
132180

181+
.PHONY: test-travis-scarlettonly
182+
test-travis-scarlettonly: export TRAVIS_CI=1
183+
test-travis-scarlettonly:
184+
$(pytest) $(test_args_no_xml) --benchmark-skip -m scarlettonly
185+
coverage report -m
186+
187+
.PHONY: test-travis-scarlettonlyintgr
188+
test-travis-scarlettonlyintgr: export TRAVIS_CI=1
189+
test-travis-scarlettonlyintgr:
190+
$(pytest) $(test_args_no_xml) --benchmark-skip -m scarlettonlyintgr
191+
coverage report -m
192+
193+
.PHONY: test-travis-scarlettonlyintgr-no-timeout
194+
test-travis-scarlettonlyintgr-no-timeout: export TRAVIS_CI=1
195+
test-travis-scarlettonlyintgr-no-timeout:
196+
$(pytest) $(test_args_no_xml) --benchmark-skip -m scarlettonlyintgr -p no:timeout
197+
coverage report -m
198+
199+
.PHONY: test-travis-scarlettonlyunittest
200+
test-travis-scarlettonlyunittest: export TRAVIS_CI=1
201+
test-travis-scarlettonlyunittest:
202+
$(pytest) $(test_args_no_xml) --benchmark-skip -m scarlettonlyunittest
203+
coverage report -m
204+
205+
.PHONY: test-travis-unittest
206+
test-travis-unittest: export TRAVIS_CI=1
207+
test-travis-unittest:
208+
$(pytest) $(test_args_no_xml) --benchmark-skip -m unittest
209+
coverage report -m
210+
133211
.PHONY: test-travis-debug
134212
test-travis-debug:
135213
$(pytest) $(test_args_no_xml) --benchmark-skip --pdb --showlocals
136214
coverage report -m
137215

216+
.PHONY: test-travis-leaks
217+
test-travis-leaks: export TRAVIS_CI=1
218+
test-travis-leaks:
219+
$(pytest) $(test_args_no_xml) --benchmark-skip -R :
220+
coverage report -m
221+
138222
.PHONY: cover
139223
cover:
140224
$(pytest) $(cover_args) --benchmark-skip
141225
coverage report -m
142226
coverage html
143227
$(BROWSER) htmlcov/index.html
144228

229+
.PHONY: cover-travisci
230+
cover-travisci: export TRAVIS_CI=1
231+
cover-travisci: display-env
232+
# $(pytest) $(cover_args) --benchmark-skip -p no:ipdb
233+
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
234+
coverage report -m
235+
coverage html
236+
$(BROWSER) htmlcov/index.html
237+
145238
.PHONY: cover-debug
146239
cover-debug:
147240
# --showlocals # show local variables in tracebacks
@@ -157,6 +250,21 @@ cover-debug-no-timeout:
157250
coverage html
158251
$(BROWSER) htmlcov/index.html
159252

253+
.PHONY: display-env
254+
display-env:
255+
@printf "=======================================\n"
256+
@printf "$$GREEN TRAVIS_CI:$$NC $(TRAVIS_CI) \n"
257+
@printf "=======================================\n"
258+
259+
# This task simulates a travis environment
260+
.PHONY: cover-debug-no-timeout-travisci
261+
cover-debug-no-timeout-travisci: export TRAVIS_CI=1
262+
cover-debug-no-timeout-travisci: display-env
263+
pytest -p no:timeout -s --tb short --cov-config .coveragerc --cov scarlett_os tests --cov-report html --benchmark-skip --pdb --showlocals
264+
coverage report -m
265+
coverage html
266+
$(BROWSER) htmlcov/index.html
267+
160268
.PHONY: shell
161269
shell:
162270
ipython
@@ -256,3 +364,34 @@ create-docker-machine:
256364
--engine-install-url "https://test.docker.com" \
257365
scarlett-1604-packer
258366
eval $(docker-machine env scarlett-1604-packer)
367+
368+
docker-compose-build:
369+
@docker-compose -f docker-compose-devtools.yml build
370+
371+
docker-compose-build-master:
372+
@docker-compose -f docker-compose-devtools.yml build master
373+
374+
docker-compose-run-master:
375+
@docker-compose -f docker-compose-devtools.yml run --name scarlett_master --rm master bash
376+
377+
docker-compose-run-test:
378+
@docker-compose -f docker-compose-devtools.yml run --name scarlett_test --rm test bash python3 --version
379+
380+
docker-compose-up:
381+
@docker-compose -f docker-compose-devtools.yml up
382+
383+
docker-compose-up-build:
384+
@docker-compose -f docker-compose-devtools.yml up --build
385+
386+
docker-compose-down:
387+
@docker-compose -f docker-compose-devtools.yml down
388+
389+
docker-version:
390+
@docker --version
391+
@docker-compose --version
392+
393+
docker-exec:
394+
@scripts/docker/exec-master
395+
396+
docker-exec-master:
397+
@scripts/docker/exec-master

container/root/docker_entrypoint.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ dbus-daemon --session --print-address=0 --print-pid=1 --fork 0>"$ADDRESS_FILE" 1
1111
export DBUS_SESSION_BUS_ADDRESS=$(cat "$ADDRESS_FILE")
1212
PID=$(cat "$PID_FILE")
1313

14+
echo "export DBUS_SESSION_BUS_ADDRESS=$(cat "$ADDRESS_FILE")" > ~pi/.exports
15+
1416
echo "D-Bus per-session daemon address is: $DBUS_SESSION_BUS_ADDRESS"
1517

1618
trap 'kill -TERM $PID' EXIT

0 commit comments

Comments
 (0)