Skip to content

Commit e4c9b16

Browse files
[feature] ignore tag (#61)
1 parent 76b2d90 commit e4c9b16

File tree

8 files changed

+322
-208
lines changed

8 files changed

+322
-208
lines changed

.devcontainer/devcontainer.json

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,45 @@
11
{
2-
"name": "Python 3",
3-
"build": {
4-
"dockerfile": "Dockerfile",
5-
"context": "..",
6-
"args": {
7-
// Update 'VARIANT' to pick a Python version: 3, 3.6, 3.7, 3.8, 3.9
8-
"VARIANT": "3.8",
9-
// Options
10-
"INSTALL_NODE": "true",
11-
"NODE_VERSION": "lts/*"
12-
}
13-
},
2+
"name": "Python 3",
3+
"build": {
4+
"dockerfile": "Dockerfile",
5+
"context": "..",
6+
"args": {
7+
// Update 'VARIANT' to pick a Python version: 3, 3.6, 3.7, 3.8, 3.9
8+
"VARIANT": "3.8",
9+
// Options
10+
"INSTALL_NODE": "true",
11+
"NODE_VERSION": "lts/*"
12+
}
13+
},
1414

15-
// Set *default* container specific settings.json values on container create.
16-
"settings": {
17-
"terminal.integrated.shell.linux": "/bin/bash",
18-
"python.pythonPath": "/usr/local/bin/python",
19-
"python.linting.enabled": true,
20-
"python.linting.pylintEnabled": true,
21-
"python.formatting.autopep8Path": "/usr/local/py-utils/bin/autopep8",
22-
"python.formatting.blackPath": "/usr/local/py-utils/bin/black",
23-
"python.formatting.yapfPath": "/usr/local/py-utils/bin/yapf",
24-
"python.linting.banditPath": "/usr/local/py-utils/bin/bandit",
25-
"python.linting.flake8Path": "/usr/local/py-utils/bin/flake8",
26-
"python.linting.mypyPath": "/usr/local/py-utils/bin/mypy",
27-
"python.linting.pycodestylePath": "/usr/local/py-utils/bin/pycodestyle",
28-
"python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle",
29-
"python.linting.pylintPath": "/usr/local/py-utils/bin/pylint"
30-
},
15+
// Set *default* container specific settings.json values on container create.
16+
"settings": {
17+
"terminal.integrated.shell.linux": "/bin/bash",
18+
"python.pythonPath": "/usr/local/bin/python",
19+
"python.linting.enabled": true,
20+
"python.linting.pylintEnabled": true,
21+
"python.formatting.autopep8Path": "/usr/local/py-utils/bin/autopep8",
22+
"python.formatting.blackPath": "/usr/local/py-utils/bin/black",
23+
"python.formatting.yapfPath": "/usr/local/py-utils/bin/yapf",
24+
"python.linting.banditPath": "/usr/local/py-utils/bin/bandit",
25+
"python.linting.flake8Path": "/usr/local/py-utils/bin/flake8",
26+
"python.linting.mypyPath": "/usr/local/py-utils/bin/mypy",
27+
"python.linting.pycodestylePath": "/usr/local/py-utils/bin/pycodestyle",
28+
"python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle",
29+
"python.linting.pylintPath": "/usr/local/py-utils/bin/pylint"
30+
},
3131

32-
// Add the IDs of extensions you want installed when the container is created.
33-
"extensions": [
34-
"ms-python.python"
35-
],
32+
// Add the IDs of extensions you want installed when the container is created.
33+
"extensions": [
34+
"ms-python.python"
35+
],
3636

37-
// Use 'forwardPorts' to make a list of ports inside the container available locally.
38-
// "forwardPorts": [],
37+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
38+
// "forwardPorts": [],
3939

40-
// Use 'postCreateCommand' to run commands after the container is created.
41-
// "postCreateCommand": "pip3 install --user -r requirements.txt",
40+
// Use 'postCreateCommand' to run commands after the container is created.
41+
// "postCreateCommand": "pip3 install --user -r requirements.txt",
4242

43-
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
44-
"remoteUser": "vscode"
43+
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
44+
"remoteUser": "vscode"
4545
}

.pre-commit-config.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ repos:
33
rev: v3.3.0
44
hooks:
55
- id: trailing-whitespace
6+
- repo: https://github.com/Lucas-C/pre-commit-hooks
7+
rev: v1.1.10
8+
hooks:
9+
- id: remove-crlf
10+
- id: remove-tabs
11+
args: [ '--whitespaces-count', '2' ]
612
- repo: https://github.com/kynan/nbstripout
713
rev: master
814
hooks:

README.md

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ pip install pytest nbmake
2323
pytest --nbmake **/*ipynb
2424
```
2525

26-
## Allow errors and Configure Cell Timeouts
26+
## Configure Cell Timeouts
2727

2828
You can configure the cell timeout with the following pytest flag:
2929

3030
```sh
3131
pytest --nbmake --nbmake-timeout=3000 # allows each cell 3000 seconds to finish
3232
```
3333

34-
Each notebook can also be separately overidden to allow errors and fail if running exceeds a timeout.
34+
## Allow Errors For a Whole Notebook
3535

3636
This configuration must be placed in the notebook's **top-level metadata** (not cell-level metadata).
3737

@@ -50,6 +50,40 @@ Your notebook should look like this:
5050
}
5151
```
5252

53+
## Allow a Cell to Throw an Exception
54+
55+
A cell with the following metadata can throw an exception without failing the test:
56+
57+
```json
58+
{
59+
"language": "python",
60+
"custom": {
61+
"metadata": {
62+
"tags": [
63+
"raises-exception"
64+
]
65+
}
66+
}
67+
}
68+
```
69+
70+
## Ignore a Code Cell
71+
72+
A cell with the following metadata will not be executed by nbmake
73+
74+
```json
75+
{
76+
"language": "python",
77+
"custom": {
78+
"metadata": {
79+
"tags": [
80+
"skip-execution"
81+
]
82+
}
83+
}
84+
}
85+
```
86+
5387
## Override Notebook Kernels when Testing
5488

5589
Regardless of the kernel configured in the notebook JSON, you can force nbmake to use a specific kernel when testing:

0 commit comments

Comments
 (0)