TIL: Dash Testing, Docker Compose, and Python Mocking
2020-07-24
·
via Stonecharioteer on Tech
Web Development and Testing
Dash Framework Testing
Flask-Dash Integration Best Practices
- Always ensure that dash registration in a Flask-Dash app is configurable
- Might want to not load dash when testing backend only
- Separation of concerns between backend API and frontend visualization
- Enables more targeted testing strategies
Python Mock Module Best Practices
- When mocking python functions in a flask test, ensure you reference the module
where the function is called, not where it originates from
- Common pitfall: mocking at the wrong import level
- Mock at the point of use, not the point of definition
- Critical for effective unit testing in complex applications
Infrastructure and Networking
Docker Compose Development Insights
- docker-compose has no docstrings
- Interesting observation about code documentation practices
- Even popular tools can have documentation gaps
- Reminder of the importance of good code documentation
Pi-hole Architecture
pihole’s Faster than light engine is a fork of dnsmasq- Built on proven DNS server technology
- Optimized for ad-blocking and DNS filtering
- Demonstrates how open source projects build on each other
argparse does support sub-commands- Python’s built-in argument parsing library is more capable than often realized
- Enables building complex CLI interfaces with nested commands
- Alternative to third-party libraries like Click for simpler use cases
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。