diff options
author | Fred Wright <fw@fwright.net> | 2018-09-29 14:26:57 -0700 |
---|---|---|
committer | Fred Wright <fw@fwright.net> | 2018-09-29 15:05:02 -0700 |
commit | 3b6af9d02279d610d9987944b7ab20543752dbdc (patch) | |
tree | 87618d33d8505c26b552902eec54611fd143cd1a | |
parent | eb591a267e6dfe37fc3184daf9ac8b6b864c835d (diff) | |
download | gpsd-3b6af9d02279d610d9987944b7ab20543752dbdc.tar.gz |
Makes test_xgps_deps more complete.
Previously, test_xgps_deps was omitting some imports that might
attempt to launch an X11 server (at least on the Mac). This can also
be avoided by unsetting DISPLAY or making it empty. This approach is
now taken, and all imports used by xgps and xgpsspeed are included.
This also adds a missing docstring and rearranges the pylint excludes.
TESTED:
Now runs without launching X11 on OSX.
-rwxr-xr-x | test_xgps_deps.py | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/test_xgps_deps.py b/test_xgps_deps.py index d6138328..cb9448ea 100755 --- a/test_xgps_deps.py +++ b/test_xgps_deps.py @@ -1,8 +1,17 @@ #!/usr/bin/env python +"""Test imports needed by X11-based tools.""" + from __future__ import print_function +import os import sys +# Keep Gtk from trying to launch X11. +# Pylint seems to defeat this hack, but we can live with that. +os.environ['DISPLAY'] = '' + +# pylint: disable=unused-import,wrong-import-position + import cairo import gi @@ -12,8 +21,7 @@ except (AttributeError, ValueError): # Explain the reason for the exception, then reraise print('*** Need PyGObject V3 or later, and Gtk3 ***', file=sys.stderr) raise -from gi.repository import GObject # pylint: disable=wrong-import-position -# Skip the imports that require X11 -### from gi.repository import Gtk # pylint: disable=wrong-import-position -### from gi.repository import Gdk # pylint: disable=wrong-import-position -### from gi.repository import Pango # pylint: disable=wrong-import-position +from gi.repository import GObject +from gi.repository import Gtk +from gi.repository import Gdk +from gi.repository import Pango |