Explicitly testing race conditions

This post relates to programming in general, but specifically to Python (because that’s where I’m working at the moment).

I’ve been working on groundstation lately, which leverages git as it’s storage backend, but also assumes that all operations are threadsafe and concurrent. As such, I want to write testcases for it’s internal implementation that actually excercise these race conditions to assert their sanity.

Obviously, I can litter my code with optional callbacks, but that’s pretty much awful. I never thought I’d genuinely wish python had macros or a preprocessor. Do you know of a sane way to approach this?

About richo

I enjoy exploring interesting concepts in weird languages. I also like hacking on all of the things.
This entry was posted in psych0tik News. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *