Example code using the Python plotly
and dash
packages for demonstration and (educational) reference.
See here:
- Developer Setup
- Local Package:
plotly_dash_demos
- Testing
- Unit-Tests
- Demo Tests
- License (Copyright)
pyenv install
-- skip this if you already have the version on your systemdirenv allow
pip install --upgrade pip
pip install poetry
-- Assumespoetry >= 1.20.0
poetry install
TBD
These sections explain and show how to test this code and how it was tested during development.
A nice reference on the different kinds of Software Testing for Python can be found here: https://realpython.com/python-testing/
An introduction to pytest
with technical details can be found here: https://docs.pytest.org/en/7.1.x/example/simple.html
Run:
pytest
This should produce an output that looks like:
========================================== test session starts ===========================================
platform darwin -- Python 3.10.7, pytest-7.2.0, pluggy-1.0.0
rootdir: /Users/tommy/dev/tommypkeane/plotly-dash_demos, configfile: pyproject.toml, testpaths: tests_unit
plugins: hypothesis-6.56.3, dash-2.6.2, cov-4.0.0
collected 0 items
/Users/tommy/dev/tommypkeane/plotly-dash_demos/.direnv/python-3.10.7/lib/python3.10/site-packages/coverage/control.py:801: CoverageWarning: No data was collected. (no-data-collected)
self._warn("No data was collected.", slug="no-data-collected")
---------- coverage: platform darwin, python 3.10.7-final-0 ----------
Name Stmts Miss Cover
---------------------------------------------------
plotly_dash_demos/__init__.py 0 0 100%
---------------------------------------------------
TOTAL 0 0 100%
========================================= no tests ran in 0.01s ==========================================
These demos are larger "functional tests" that are actually localized demonstrations of plotly
and dash
functionality which can be tested, edited, or run here in-place.
Some of these may not rely on the local plotly_dash_demos
package, and may be fully self-contained.
See the local README.md for more details on what demos are currently available, and how to run them.
See LICENSE file.