79bea56
From 35a5b281adea321ea3f7b7d688a994e735366fb0 Mon Sep 17 00:00:00 2001
79bea56
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
79bea56
Date: Thu, 22 Sep 2016 20:12:15 -0400
79bea56
Subject: [PATCH] tests: add workaround for pre-232 system returning EINVAL on
79bea56
 some flags
79bea56
79bea56
---
79bea56
 systemd/test/test_journal.py | 20 +++++++++++++++-----
79bea56
 1 file changed, 15 insertions(+), 5 deletions(-)
79bea56
79bea56
diff --git a/systemd/test/test_journal.py b/systemd/test/test_journal.py
79bea56
index 090218334d..dceec3f18d 100644
79bea56
--- a/systemd/test/test_journal.py
79bea56
+++ b/systemd/test/test_journal.py
79bea56
@@ -21,6 +21,13 @@ def skip_enosys():
79bea56
             pytest.skip()
79bea56
         raise
79bea56
 
79bea56
+@contextlib.contextmanager
79bea56
+def skip_valueerror():
79bea56
+    try:
79bea56
+        yield
79bea56
+    except ValueError:
79bea56
+        pytest.skip()
79bea56
+
79bea56
 def test_priorities():
79bea56
     p = journal.JournalHandler.mapPriority
79bea56
 
79bea56
@@ -62,10 +69,12 @@ def test_reader_init_flags():
79bea56
 def test_reader_os_root(tmpdir):
79bea56
     with pytest.raises(ValueError):
79bea56
         journal.Reader(journal.OS_ROOT)
79bea56
-    j1 = journal.Reader(path=tmpdir.strpath,
79bea56
-                        flags=journal.OS_ROOT)
79bea56
-    j2 = journal.Reader(path=tmpdir.strpath,
79bea56
-                        flags=journal.OS_ROOT | journal.CURRENT_USER)
79bea56
+    with skip_valueerror():
79bea56
+        j1 = journal.Reader(path=tmpdir.strpath,
79bea56
+                            flags=journal.OS_ROOT)
79bea56
+    with skip_valueerror():
79bea56
+        j2 = journal.Reader(path=tmpdir.strpath,
79bea56
+                            flags=journal.OS_ROOT | journal.CURRENT_USER)
79bea56
     j3 = journal.Reader(path=tmpdir.strpath,
79bea56
                         flags=journal.OS_ROOT | journal.SYSTEM_ONLY)
79bea56
 
79bea56
@@ -91,7 +100,8 @@ def test_reader_init_path_fd(tmpdir):
79bea56
         j1 = journal.Reader(path=fd)
79bea56
     assert list(j1) == []
79bea56
 
79bea56
-    j2 = journal.Reader(journal.SYSTEM, path=fd)
79bea56
+    with skip_valueerror():
79bea56
+        j2 = journal.Reader(journal.SYSTEM, path=fd)
79bea56
     assert list(j2) == []
79bea56
 
79bea56
     j3 = journal.Reader(journal.CURRENT_USER, path=fd)
79bea56
-- 
79bea56
2.9.0
79bea56