Spaces:
Sleeping
Sleeping
rmm
commited on
Commit
·
8d0dee7
1
Parent(s):
ef0921f
docs: explanation for how to use debug env variable
Browse files- docs/dev_notes.md +24 -7
docs/dev_notes.md
CHANGED
|
@@ -13,7 +13,7 @@ Then use a web browser to view the site indiciated, by default: http://localhost
|
|
| 13 |
|
| 14 |
# How to build and view docs locally
|
| 15 |
|
| 16 |
-
We have a CI action to
|
| 17 |
To validate locally, you need the deps listed in `requirements.txt` installed.
|
| 18 |
|
| 19 |
Run
|
|
@@ -51,14 +51,15 @@ The CI runs with `--strict-markers` so any new marker must be registered in
|
|
| 51 |
|
| 52 |
- the basic CI action runs the fast tests only, skipping all tests marked
|
| 53 |
`visual` and `slow`
|
| 54 |
-
- the CI action on PR runs the `slow` tests, but
|
| 55 |
-
-
|
| 56 |
|
| 57 |
Check all tests are marked ok, and that they are filtered correctly by the
|
| 58 |
groupings used in CI:
|
| 59 |
```bash
|
| 60 |
pytest --collect-only -m "not slow and not visual" --strict-markers --ignore=tests/visual_selenium
|
| 61 |
pytest --collect-only -m "not visual" --strict-markers --ignore=tests/visual_selenium
|
|
|
|
| 62 |
```
|
| 63 |
|
| 64 |
|
|
@@ -97,7 +98,8 @@ pytest --cov-report=lcov --cov=src
|
|
| 97 |
|
| 98 |
We use seleniumbase to test the visual appearance of the app, including the
|
| 99 |
presence of elements that appear through the workflow. This testing takes quite
|
| 100 |
-
a long time to execute
|
|
|
|
| 101 |
|
| 102 |
```bash
|
| 103 |
# install packages for app and for visual testing
|
|
@@ -106,14 +108,15 @@ pip install -r tests/visual_selenium/requirements_visual.txt
|
|
| 106 |
```
|
| 107 |
|
| 108 |
**Running tests**
|
| 109 |
-
The execution of these tests requires that the site/app is running already
|
|
|
|
| 110 |
|
| 111 |
-
|
| 112 |
```bash
|
| 113 |
streamlit run src/main.py
|
| 114 |
```
|
| 115 |
|
| 116 |
-
In another tab:
|
| 117 |
```bash
|
| 118 |
# run just the visual tests
|
| 119 |
pytest -m "visual" --strict-markers
|
|
@@ -132,3 +135,17 @@ pytest -m "not slow and not visual" --strict-markers --ignore=tests/visual_selen
|
|
| 132 |
Initially we have an action setup that runs all tests in the `tests` directory, within the `test/tests` branch.
|
| 133 |
|
| 134 |
TODO: Add some test report & coverage badges to the README.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
# How to build and view docs locally
|
| 15 |
|
| 16 |
+
We have a CI action to present the docs on github.io.
|
| 17 |
To validate locally, you need the deps listed in `requirements.txt` installed.
|
| 18 |
|
| 19 |
Run
|
|
|
|
| 51 |
|
| 52 |
- the basic CI action runs the fast tests only, skipping all tests marked
|
| 53 |
`visual` and `slow`
|
| 54 |
+
- the CI action on PR runs the `slow` tests, but still excluding `visual`.
|
| 55 |
+
- a second action for the visual tests runs on PR.
|
| 56 |
|
| 57 |
Check all tests are marked ok, and that they are filtered correctly by the
|
| 58 |
groupings used in CI:
|
| 59 |
```bash
|
| 60 |
pytest --collect-only -m "not slow and not visual" --strict-markers --ignore=tests/visual_selenium
|
| 61 |
pytest --collect-only -m "not visual" --strict-markers --ignore=tests/visual_selenium
|
| 62 |
+
pytest --collect-only -m "visual" --strict-markers tests/visual_selenium/ -s --demo
|
| 63 |
```
|
| 64 |
|
| 65 |
|
|
|
|
| 98 |
|
| 99 |
We use seleniumbase to test the visual appearance of the app, including the
|
| 100 |
presence of elements that appear through the workflow. This testing takes quite
|
| 101 |
+
a long time to execute. It is configured in a separate CI action
|
| 102 |
+
(`python-visualtests.yml`).
|
| 103 |
|
| 104 |
```bash
|
| 105 |
# install packages for app and for visual testing
|
|
|
|
| 108 |
```
|
| 109 |
|
| 110 |
**Running tests**
|
| 111 |
+
The execution of these tests requires that the site/app is running already, which
|
| 112 |
+
is handled by a fixture (that starts the app in another thread).
|
| 113 |
|
| 114 |
+
Alternatively, in one tab, run:
|
| 115 |
```bash
|
| 116 |
streamlit run src/main.py
|
| 117 |
```
|
| 118 |
|
| 119 |
+
In another tab, run:
|
| 120 |
```bash
|
| 121 |
# run just the visual tests
|
| 122 |
pytest -m "visual" --strict-markers
|
|
|
|
| 135 |
Initially we have an action setup that runs all tests in the `tests` directory, within the `test/tests` branch.
|
| 136 |
|
| 137 |
TODO: Add some test report & coverage badges to the README.
|
| 138 |
+
|
| 139 |
+
|
| 140 |
+
## Environment flags used in development
|
| 141 |
+
|
| 142 |
+
- `DEBUG_AUTOPOPULATE_METADATA=True` : Set this env variable to have the text
|
| 143 |
+
inputs autopopulated, to make stepping through the workflow faster during
|
| 144 |
+
development work.
|
| 145 |
+
|
| 146 |
+
Typical usage:
|
| 147 |
+
|
| 148 |
+
```bash
|
| 149 |
+
DEBUG_AUTOPOPULATE_METADATA=True streamlit run src/main.py
|
| 150 |
+
```
|
| 151 |
+
|