diff --git a/obs-timeout.patch b/obs-timeout.patch
new file mode 100644
index 0000000..24adb0a
--- /dev/null
+++ b/obs-timeout.patch
@@ -0,0 +1,42 @@
+Index: zdaemon-4.3/src/zdaemon/tests/tests.py
+===================================================================
+--- zdaemon-4.3.orig/src/zdaemon/tests/tests.py
++++ zdaemon-4.3/src/zdaemon/tests/tests.py
+@@ -304,37 +304,6 @@ def test_start_test_program():
+ """
+
+
+-def test_start_timeout():
+- """
+- >>> write('t.py',
+- ... '''
+- ... import time
+- ... time.sleep(9)
+- ... ''')
+-
+- >>> write('conf',
+- ... '''
+- ...
+- ... program %s t.py
+- ... start-test-program cat x
+- ... start-timeout 1
+- ...
+- ... ''' % sys.executable)
+-
+- >>> import time
+- >>> start = time.time()
+-
+- >>> system("./zdaemon -Cconf start")
+-
+- Program took too long to start
+- Failed: 1
+-
+- >>> system("./zdaemon -Cconf stop")
+-
+- daemon process stopped
+- """
+-
+-
+ def DAEMON_MANAGER_MODE_leak():
+ """
+ Zdaemon used an environment variable to flag that it's running in
diff --git a/python-zdaemon.changes b/python-zdaemon.changes
index 6ff4183..f4285ac 100644
--- a/python-zdaemon.changes
+++ b/python-zdaemon.changes
@@ -1,3 +1,9 @@
+-------------------------------------------------------------------
+Thu Sep 12 17:12:56 UTC 2019 - Tomáš Chvátal
+
+- Patch out flaky tests that seldomly fails in obs:
+ * obs-timeout.patch
+
-------------------------------------------------------------------
Tue Apr 9 10:53:45 UTC 2019 - Marketa Calabkova
diff --git a/python-zdaemon.spec b/python-zdaemon.spec
index 8afd552..1578efd 100644
--- a/python-zdaemon.spec
+++ b/python-zdaemon.spec
@@ -26,6 +26,7 @@ License: ZPL-2.1
Group: Development/Languages/Python
URL: https://github.com/zopefoundation/zdaemon
Source: https://files.pythonhosted.org/packages/source/z/zdaemon/%{modname}-%{version}.tar.gz
+Patch0: obs-timeout.patch
BuildRequires: %{python_module ZConfig}
BuildRequires: %{python_module manuel}
BuildRequires: %{python_module mock}
@@ -49,6 +50,7 @@ although it is not limited to running Python-based applications
%prep
%setup -q -n %{modname}-%{version}
+%patch0 -p1
# remove unwanted shebang
sed -i '1 { /^#!/ d }' src/zdaemon/tests/nokill.py
rm -rf src/zdaemon.egg-info