]> granicus.if.org Git - graphviz/commitdiff
Unset the DISPLAY environment variable in tools test
authorMagnus Jacobsson <magnus.jacobsson@berotec.se>
Tue, 29 Sep 2020 09:39:53 +0000 (11:39 +0200)
committerMagnus Jacobsson <magnus.jacobsson@berotec.se>
Thu, 8 Oct 2020 19:10:23 +0000 (21:10 +0200)
This ensures that the test fails instead of hanging if print usage and
exit fails and the program continues and tries to open the display.

rtest/test_tools.py

index e4beca204c38c80ee00d1e115ac447716ed96027..dafbcf4f931129019df4126d7b1ab2978abb6a6f 100644 (file)
@@ -141,9 +141,14 @@ def test_tools(tool):
             pytest.skip('gvpack does not find libgvplugin_neato_layout.so.6'
                         'when built with CMake (#1838)')
 
+    # Ensure that X fails to open display
+    environ_copy = os.environ.copy()
+    environ_copy.pop('DISPLAY', None)
+
     # Test usage
     output = subprocess.check_output(
         [tool, '-?'],
+        env=environ_copy,
         stdin=subprocess.DEVNULL,
         stderr=subprocess.STDOUT,
         universal_newlines=True,