Skip to content

Commit 5a7d57e

Browse files
committed
test: add tests and linting
1 parent 6531610 commit 5a7d57e

32 files changed

+1227
-158
lines changed

.devcontainer/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "umask 0002 && . /usr/l
2222
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1
2323

2424
USER vscode
25-
ENV PATH="~/.poetry/bin:$PATH" \
25+
ENV PATH="/home/vscode/.poetry/bin:$PATH" \
2626
POETRY_VIRTUALENVS_IN_PROJECT="true"
2727

2828
RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python -

.devcontainer/devcontainer.json

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,43 +5,45 @@
55
"build": {
66
"dockerfile": "Dockerfile",
77
"context": "..",
8-
"args": {
8+
"args": {
99
// Update 'VARIANT' to pick a Python version: 3, 3.6, 3.7, 3.8, 3.9
1010
"VARIANT": "3.9",
1111
// Options
1212
"INSTALL_NODE": "false",
1313
"NODE_VERSION": "lts/*"
1414
}
1515
},
16-
1716
// Set *default* container specific settings.json values on container create.
18-
"settings": {
17+
"settings": {
1918
"terminal.integrated.shell.linux": "/bin/bash",
20-
"python.pythonPath": "/usr/local/bin/python",
19+
"editor.formatOnSave": true,
20+
"python.pythonPath": ".venv/bin/python",
2121
"python.linting.enabled": true,
22+
"python.linting.lintOnSave": true,
23+
"python.linting.mypyEnabled": true,
2224
"python.linting.pylintEnabled": true,
23-
"python.formatting.autopep8Path": "/usr/local/py-utils/bin/autopep8",
24-
"python.formatting.blackPath": "/usr/local/py-utils/bin/black",
25-
"python.formatting.yapfPath": "/usr/local/py-utils/bin/yapf",
26-
"python.linting.banditPath": "/usr/local/py-utils/bin/bandit",
27-
"python.linting.flake8Path": "/usr/local/py-utils/bin/flake8",
28-
"python.linting.mypyPath": "/usr/local/py-utils/bin/mypy",
29-
"python.linting.pycodestylePath": "/usr/local/py-utils/bin/pycodestyle",
30-
"python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle",
31-
"python.linting.pylintPath": "/usr/local/py-utils/bin/pylint"
25+
"python.linting.pydocstyleEnabled": true,
26+
"python.linting.mypyPath": ".venv/bin/mypy",
27+
"python.linting.pydocstylePath": ".venv/bin/pydocstyle",
28+
"python.linting.pylintPath": ".venv/bin/pylint",
29+
"python.testing.pytestEnabled": true,
30+
"python.testing.pytestArgs": [
31+
"tests"
32+
],
33+
"python.formatting.blackPath": ".venv/bin/black",
34+
"editor.codeActionsOnSave": {
35+
"source.organizeImports": true
36+
},
3237
},
33-
3438
// Add the IDs of extensions you want installed when the container is created.
3539
"extensions": [
36-
"ms-python.python"
40+
"ms-python.python",
41+
"ms-python.vscode-pylance",
3742
],
38-
3943
// Use 'forwardPorts' to make a list of ports inside the container available locally.
4044
// "forwardPorts": [],
41-
4245
// Use 'postCreateCommand' to run commands after the container is created.
4346
// "postCreateCommand": "pip3 install --user -r requirements.txt",
44-
4547
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
4648
"remoteUser": "vscode"
47-
}
49+
}

.vscode/settings.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

Makefile

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# do any initial setup
2+
setup:
3+
poetry install
4+
5+
# commands to run after git update
6+
update:
7+
poetry install
8+
9+
# commands as run by CI
10+
ci: lint
11+
HYPOTHESIS_PROFILE=slow poetry run pytest -vv --cov
12+
13+
# launch the interpreter in repl mode
14+
repl:
15+
poetry run python
16+
17+
lint:
18+
poetry run isort --check-only .
19+
poetry run black --check .
20+
poetry run pydocstyle
21+
poetry run pylint src/conjecture
22+
poetry run pylint --disable=missing-function-docstring,duplicate-code tests
23+
poetry run mypy --strict --pretty .
24+
25+
# run the tests locally
26+
test:
27+
poetry run pytest --testdox --cov --cov-report html
28+
29+
# automatically format codebase to pass linting rules
30+
format:
31+
poetry run isort --atomic .
32+
poetry run black .
33+
34+
.PHONY: setup update ci repl test format

0 commit comments

Comments
 (0)