-
Notifications
You must be signed in to change notification settings - Fork 2
Use pytest for simpler tests #17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 6 commits
4e5cb0e
aa59787
d076ccf
669df36
657323f
eaf8faa
2183ee0
d773ec3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| rules: | ||
| sudo_usage: off |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| FROM python:3.12-slim | ||
|
|
||
| # Install essential packages and create non-root user | ||
| RUN apt-get update && apt-get install -y --no-install-recommends git curl sudo bash-completion vim \ | ||
| && useradd -m -s /bin/bash vscode \ | ||
| && echo "vscode ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers \ | ||
| && mkdir -p /workspace \ | ||
| && chown vscode:vscode /workspace \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| WORKDIR /workspace | ||
|
|
||
| # Switch to non-root user | ||
| USER vscode | ||
|
|
||
| # Set up shell completions | ||
| RUN echo 'source /usr/share/bash-completion/completions/git' >> ~/.bashrc \ | ||
| && echo 'source /etc/bash_completion' >> ~/.bashrc | ||
|
|
||
| # Set up uv and Python environment | ||
| RUN curl -LsSf https://astral.sh/uv/install.sh | sh | ||
|
|
||
| # Set up environment variables | ||
| ENV PATH="/home/vscode/.local/bin:${PATH}" | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,43 @@ | ||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||
| "name": "py-cppmodel Dev Container", | ||||||||||||||||||||||||||||
| "build": { | ||||||||||||||||||||||||||||
| "dockerfile": "Dockerfile", | ||||||||||||||||||||||||||||
| "context": ".." | ||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||
|
Comment on lines
+1
to
+6
|
||||||||||||||||||||||||||||
| "customizations": { | ||||||||||||||||||||||||||||
| "vscode": { | ||||||||||||||||||||||||||||
| "extensions": [ | ||||||||||||||||||||||||||||
| "charliermarsh.ruff", | ||||||||||||||||||||||||||||
| "esbenp.prettier-vscode", | ||||||||||||||||||||||||||||
| "github.vscode-pull-request-github", | ||||||||||||||||||||||||||||
| "ms-python.mypy-type-checker", | ||||||||||||||||||||||||||||
| "ms-python.python", | ||||||||||||||||||||||||||||
| "ms-python.vscode-pylance", | ||||||||||||||||||||||||||||
| "ms-toolsai.jupyter-keymap", | ||||||||||||||||||||||||||||
| "ms-toolsai.jupyter-renderers", | ||||||||||||||||||||||||||||
| "ms-toolsai.jupyter", | ||||||||||||||||||||||||||||
| "ms-toolsai.vscode-jupyter-cell-tags", | ||||||||||||||||||||||||||||
| "ms-toolsai.vscode-jupyter-slideshow", | ||||||||||||||||||||||||||||
| ], | ||||||||||||||||||||||||||||
| "settings": { | ||||||||||||||||||||||||||||
| "python.defaultInterpreterPath": "/${workspaceFolder}/.venv/bin/python", | ||||||||||||||||||||||||||||
| "[python]": { | ||||||||||||||||||||||||||||
| "editor.defaultFormatter": "charliermarsh.ruff", | ||||||||||||||||||||||||||||
| "editor.formatOnSave": true, | ||||||||||||||||||||||||||||
| "editor.codeActionsOnSave": { | ||||||||||||||||||||||||||||
| "source.organizeImports": "explicit" | ||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||
| "mounts": [ | ||||||||||||||||||||||||||||
| "source=${localWorkspaceFolder},target=/workspace,type=bind,consistency=cached", | ||||||||||||||||||||||||||||
| "source=${localEnv:HOME}/.ssh,target=/home/vscode/.ssh,type=bind,consistency=cached" | ||||||||||||||||||||||||||||
| ], | ||||||||||||||||||||||||||||
| "remoteUser": "vscode", | ||||||||||||||||||||||||||||
| "updateRemoteUserUID": true, | ||||||||||||||||||||||||||||
| "remoteEnv": { | ||||||||||||||||||||||||||||
| "UV_LINK_MODE": "copy" | ||||||||||||||||||||||||||||
|
Comment on lines
+36
to
+41
|
||||||||||||||||||||||||||||
| "source=${localEnv:HOME}/.ssh,target=/home/vscode/.ssh,type=bind,consistency=cached" | |
| ], | |
| "remoteUser": "vscode", | |
| "updateRemoteUserUID": true, | |
| "remoteEnv": { | |
| "UV_LINK_MODE": "copy" | |
| "source=${localEnv:SSH_AUTH_SOCK},target=/ssh-agent,type=bind" | |
| ], | |
| "remoteUser": "vscode", | |
| "updateRemoteUserUID": true, | |
| "remoteEnv": { | |
| "UV_LINK_MODE": "copy", | |
| "SSH_AUTH_SOCK": "/ssh-agent" |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -20,9 +20,14 @@ dev = [ | |||||
| "jupyter>=1.1.1", | ||||||
| "parameterized>=0.9.0", | ||||||
|
||||||
| "parameterized>=0.9.0", |
Copilot
AI
Jan 31, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Setting addopts = "-n auto -v" makes pytest-xdist effectively mandatory for any pytest invocation (otherwise -n is an unknown option). Consider moving -n auto to CI/scripts (or using required_plugins to fail with a clearer message) so local/packaging workflows that install only pytest don’t break.
| addopts = "-n auto -v" | |
| addopts = "-v" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,4 +7,4 @@ uv sync | |
| uv run ty check . | ||
|
|
||
| # Unit tests | ||
| uv run python -m unittest discover --verbose . | ||
| uv run pytest | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Installing
uvviacurl ... | shwithout pinning a version and verifying integrity is a supply-chain risk. For a devcontainer, consider installing a specific released version (and validating a checksum/signature) or using a package-based install method to make builds reproducible.