all AI news
time-machine example test for a segfault in Python
March 23, 2024, 7:44 p.m. |
Simon Willison's Weblog simonwillison.net
time-machine example test for a segfault in Python
Here's a really neat testing trick by Adam Johnson. Someone reported a segfault bug in his time-machine library. How you you write a unit test that exercises a segfault without crashing the entire test suite?
Adam's solution is a test that does this:
subprocess.run([sys.executable, "-c", code_that_crashes_python], check=True)
sys.executable is the path to the current Python executable - ensuring the code will run in the same virtual environment as the test suite itself. …
adam example library machine python solution test testing trick
More from simonwillison.net / Simon Willison's Weblog
Food Delivery Leak Unmasks Russian Security Agents
1 day, 22 hours ago |
simonwillison.net
Quoting Alex Jason, via Adam Savage
2 days, 10 hours ago |
simonwillison.net
Blogmarks that use markdown
2 days, 20 hours ago |
simonwillison.net
No, Most Books Don't Sell Only a Dozen Copies
2 days, 20 hours ago |
simonwillison.net
Jobs in AI, ML, Big Data
Data Architect
@ University of Texas at Austin | Austin, TX
Data ETL Engineer
@ University of Texas at Austin | Austin, TX
Lead GNSS Data Scientist
@ Lurra Systems | Melbourne
Senior Machine Learning Engineer (MLOps)
@ Promaton | Remote, Europe
Director, Clinical Data Science
@ Aura | Remote USA
Research Scientist, AI (PhD)
@ Meta | Menlo Park, CA | New York City