Skip to content

Instantly share code, notes, and snippets.

@hagino3000
Last active December 20, 2016 04:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hagino3000/7169610 to your computer and use it in GitHub Desktop.
Save hagino3000/7169610 to your computer and use it in GitHub Desktop.
watchmedo(watchdog)を使ってエディタでファイルを保存する度にテストを実行する時の設定 ref: http://qiita.com/hagino3000/items/916bf61a0639b46ccffd
let OSTYPE = system('uname')
if OSTYPE == "Darwin\n"
set noswapfile
set nowritebackup
endif
pip install watchdog
watchmedo shell-command --patterns="*.py" --recursive --command='echo "${watch_src_path} is saved"' .
let OSTYPE = system('uname')
if OSTYPE == "Darwin\n"
set noswapfile
set nowritebackup
endif
watch:
# appディレクトリ以下の*.pyファイルのイベントを監視してmake testを実行する
@echo Watch file changes and run test
watchmedo shell-command --interval=5 --patterns="*.py" -R -D --command='make test' app
test:
# (例) Djangoのテストを実行する
# watchタスクからmake testが連続で実行される事があるので、ロックファイルを作って連続起動しないようにする
@if [ ! -f .testing.lock ]; then \
touch .testing.lock; \
cd app; \
python manage.py test;\
cd ../; rm .testing.lock;\
fi
watch:
# appディレクトリ以下の*.pyファイルのイベントを監視してmake testを実行する
@echo Watch file changes and run test
watchmedo shell-command --interval=5 --patterns="*.py" -R -W -D --command='make test' app
test:
# (例) Djangoのテストを実行する
python app/manage.py test;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment