-
Notifications
You must be signed in to change notification settings - Fork 2
/
.daemon.py
38 lines (34 loc) · 1.09 KB
/
.daemon.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import json
import logging
import shlex
import subprocess
from pathlib import Path
from watchman_context import with_triggers # curl -o ~/Downloads/watchman_context.py https://gist.githubusercontent.com/speezepearson/39dd07131dd27e81b92e6794b182dba7/raw/f57f13f2070480edb0b304655a8728ec6296e3da/watchman_context.py
import xargsd.server # pip install xargsd
TRIGGERS = [
{
"name": "pytest",
"expression": [
"allof",
["not", ["pcre", ".*/__pycache__/.*", "wholename"]],
[
"anyof",
["pcre", "browsergui/.*\\.py", "wholename"],
["pcre", "test/.*\\.py", "wholename"]
]
],
"stdin": ["name", "mode"],
"command": [
"bash",
"-c",
"python -m xargsd.client -s .xargsd-pytest.sock ."
]
}
]
with with_triggers(dir='.', triggers=TRIGGERS):
xargsd.server.run_server_sync(
command=['chime-success', 'pytest', '--color=yes'],
socket_file='.xargsd-pytest.sock',
unique=True,
log_level=logging.INFO,
)