You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .agents/context/testing.md
+25-3Lines changed: 25 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,20 @@
1
1
# Testing Instructions
2
2
3
-
Cypress 9 for E2E and visual regression. No Python unit tests — validation is via demo scripts and Cypress.
3
+
Two layers: **pytest** for Python unit tests (pure functions, server utils, window/env lifecycle) and **Cypress 9** for E2E and visual regression. Demo scripts remain useful for manual/visual validation.
4
4
5
-
## Run Tests
5
+
## Run Python Tests (pytest)
6
+
7
+
```bash
8
+
pip install -r test-requirements.txt # includes pytest, pytest-cov
9
+
pytest # runs the tracked suite under py/tests/
10
+
pytest -m "not server"# skip tests that need a live server (CI default)
11
+
```
12
+
13
+
Config lives in `pyproject.toml` (`[tool.pytest.ini_options]`): discovery is scoped to
14
+
`py/tests/` and `pythonpath = ["py"]` makes `import visdom` work without an editable install.
15
+
Experimental `test_*.py` scripts in the repo root (and `test/`) are intentionally out of scope.
16
+
17
+
## Run E2E / Visual Tests (Cypress)
6
18
7
19
```bash
8
20
visdom -port 8098 -env_path /tmp # Always start fresh server first
@@ -24,9 +36,19 @@ Always use port `8098` and `-env_path /tmp` for isolation.
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+7-1Lines changed: 7 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -193,13 +193,19 @@ To run the predefined tests
193
193
5. run `npm run test:gui` (a new window should appear)
194
194
6. click through the test spec-files and observe the tests done automatically in a newly opened browser instance
195
195
196
-
**as CLI tests**:
196
+
**as CLI tests (Cypress)**:
197
197
1. start a fresh visdom server instance on port `8098` , i.e. by just calling `visdom -port 8098` (Just to make sure another instance is not interfering with our test.)
198
198
2. run `npm run test:init`. This generates screenshots of all plots for the visual regression testing.
199
199
3. Adapt the code now to your needs.
200
200
4. run `npm run build`*or*`npm run dev` (enables automatic building)
201
201
5. run `npm run test`
202
202
203
+
**using Playwright (E2E tests)**:
204
+
1. start a fresh visdom server instance on port `8098` using your environment's Python, i.e. `python -m visdom.server -port 8098 -env_path playwright/tmp` (make sure no other instances interfere).
205
+
2. run `npx playwright install chromium` on first setup to install the browser.
206
+
3. run `npm run build`*or*`npm run dev` to compile the frontend code.
207
+
4. run the Playwright test suite: `npm run test:pw`
208
+
203
209
## Issues
204
210
We use GitHub issues to track public bugs. Please ensure your description is
205
211
clear and has sufficient instructions to be able to reproduce the issue.
@@ -579,6 +582,57 @@ The following `opts` are supported:
579
582
-`opts.traceopts` : `dict` mapping trace names or indices to `dict`s of additional options that plot.ly accepts for a trace.
580
583
-`opts.webgl` : use WebGL for plotting (`boolean`; default = `false`). It is faster if a plot contains too many points. Use sparingly as browsers won't allow more than a couple of WebGL contexts on a single page.
581
584
585
+
#### vis.roc_curve
586
+
This function draws a ROC curve for binary classification.
587
+
588
+
It accepts either:
589
+
- raw binary labels and scores via `y_true` and `y_score`, or
590
+
- precomputed curve points via `fpr` and `tpr`.
591
+
592
+
The following `opts` are supported:
593
+
-`opts.title` : plot title (`string`; default includes ROC-AUC)
594
+
-`opts.legend` : two legend labels for curve and baseline (`list`)
This function draws named machine-learning metrics as line plots. It accepts a mapping from metric names to scalar values or equal-length 1D series and forwards to [`vis.line`](#visline).
This function draws a stem plot. It takes as input an `N` or `NxM` tensor
@@ -935,7 +989,7 @@ visdom is Apache 2.0 licensed, as found in the LICENSE file.
935
989
Support for Lua Torch was deprecated following `v0.1.8.4`. If you'd like to use torch support, you'll need to download that release. You can follow the usage instructions there, but it is no longer officially supported.
936
990
937
991
## Contributing
938
-
See guidelines for contributing [here.](./CONTRIBUTING.md)
992
+
See guidelines for contributing and running E2E/visual tests (Cypress and Playwright) [here.](./CONTRIBUTING.md)
939
993
940
994
## Acknowledgments
941
995
Visdom was inspired by tools like [display](https://github.com/szym/display) and relies on [Plotly](https://plot.ly/) as a plotting front-end.
0 commit comments