fix FTBFS randomly The failure happens randomly. Sometimes it happens, sometimes it does not, so the only recipe to reproduce it is to try many times. AFAIK, this being a primality test, I assume the outcome is either "not prime" or "maybe prime", so the only way to test the test is by giving a known prime and expect "maybe prime" as output. . So: Why is the test calling mr.test with 221, which is not prime? (221 = 13 x 17) . And why this fails randomly? Does the test perform random calculations internally and it's therefore not deterministic? Even in such case I don't see how a non-prime like 221 may help to catch obvious errors in a test suite for a primality test.