aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorArthur Zamarin <arthurzam@gentoo.org>2022-08-19 09:34:57 +0300
committerArthur Zamarin <arthurzam@gentoo.org>2022-08-19 09:34:57 +0300
commit8d8d956fd46f38758c74646e20d9d2248d455bf5 (patch)
treea20abe76f99bf373f505418b9043b9648c677612 /tests
parentMissingInherits: fix false positives with unset (diff)
downloadpkgcheck-8d8d956fd46f38758c74646e20d9d2248d455bf5.tar.gz
pkgcheck-8d8d956fd46f38758c74646e20d9d2248d455bf5.tar.bz2
pkgcheck-8d8d956fd46f38758c74646e20d9d2248d455bf5.zip
addons/test_eclass.py: fix flaky test_eclass_changes
Sometimes the code was faster than the precision of the time on file system, which resulted in no eclass cache update. I think a sleep of 1 second should be enough to make the test reliable. Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/addons/test_eclass.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/addons/test_eclass.py b/tests/addons/test_eclass.py
index 3fcb27c5..4e1b26db 100644
--- a/tests/addons/test_eclass.py
+++ b/tests/addons/test_eclass.py
@@ -1,5 +1,6 @@
import os
import textwrap
+from time import sleep
from unittest.mock import patch
import pytest
@@ -106,13 +107,13 @@ class TestEclassAddon:
self.addon.update_cache()
save_cache.assert_called_once()
- @pytest.mark.xfail(reason='Flaky')
def test_eclass_changes(self):
"""The cache stores eclass mtimes and regenerates entries if they differ."""
eclass_path = pjoin(self.eclass_dir, 'foo.eclass')
touch(eclass_path)
self.addon.update_cache()
assert list(self.addon.eclasses) == ['foo']
+ sleep(1)
with open(eclass_path, 'w') as f:
f.write('# changed eclass\n')
with patch('pkgcheck.addons.caches.CachedAddon.save_cache') as save_cache: