Skip to content

Commit 4b0f9ea

Browse files
committed
Get things working on more interpreter versions
1 parent f25df6c commit 4b0f9ea

2 files changed

Lines changed: 11 additions & 10 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ name = "nobodd"
77
version = "0.5"
88
description = "A simple TFTP boot server for the Raspberry Pi"
99
readme = {file="README.rst", content-type="text/x-rst"}
10-
license = "GPL-3.0-or-later"
11-
license-files = ["LICENSE.txt"]
10+
license = {text="GPL-3.0-or-later"}
1211
keywords = ["raspberry", "pi", "boot", "nbd", "tftp"]
1312
authors = [
1413
{name = "Dave Jones", email = "dave.jones@canonical.com"},

tests/test_locks.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from time import sleep
1+
from time import sleep, monotonic
22
from threading import Thread, Event, Lock, get_ident
33

44
import pytest
@@ -236,6 +236,7 @@ def writer():
236236
assert results == [False]
237237

238238

239+
@pytest.mark.xfail(reason="flaky test")
239240
def test_rwlock_read_upgrade_fail_on_writer():
240241
got_read = Event()
241242
get_upgrade = Event()
@@ -260,11 +261,12 @@ def writer():
260261
with lock.write._block_writers:
261262
pass
262263

263-
# Because we're relying on random chance in the scheduler this is a
264-
# flaky test; we'll try it 100 times and if we're lucky at least 1 will
265-
# hit the jackpot. On a reasonably unloaded system this usually occurs
266-
# within 1 or 2 loops, but on a loaded one it can take dozens of tries
267-
for i in range(100):
264+
# Because we're relying on random chance in the scheduler this is a flaky
265+
# test and is marked to xfail. It seems very dependent on architecture,
266+
# interpreter version and so forth. I can usually get this working on a Pi
267+
# with an older interpreter, but a big PC with a later one is impossible.
268+
start = monotonic()
269+
while True:
268270
upgrader_t = Thread(target=upgrader, daemon=True)
269271
upgrader_t.start()
270272
got_read.wait()
@@ -284,5 +286,5 @@ def writer():
284286
get_upgrade.clear()
285287
getting_write.clear()
286288
results.clear()
287-
else:
288-
assert False
289+
if monotonic() - start > 2:
290+
assert False

0 commit comments

Comments
 (0)