#4751 test_request_pull_close is non-deterministic
Closed: Fixed by pingou. Opened by sergiodj.

While preparing the Debian pagure package to run its testsuite, I noticed that test_request_pull_close is non-deterministic and can fail depending on the system load.

The test expects (at many places) to see a string like:

Merged just now...

However, in my system, the string was actually:

Merged seconds ago...

This made the test fail. I don't know if assertIn can be made to expect a regexp; I'll try to investigate this further. Meanwhile, I thought it'd be good to file this bug for the record.


There's assertRegex:

https://docs.python.org/3/library/unittest.html#unittest.TestCase.assertRegex

I don't think assertIn accepts a regexp.

We have regex tests already, but the approach is different: use an standard Python re.match(), then assert on its result :)

I couldn't find the re.match() tests, so I went ahead and prepared a patch with assertRegex. I'll create the PR in a few minutes.

https://pagure.io/pagure/pull-request/4752

Commit 1c9abcd1 fixes this issue

Metadata
Related Pull Requests