From 24b1b9a480a691133fff79846837632269148a9a Mon Sep 17 00:00:00 2001 From: David Nadlinger Date: Sat, 12 Jan 2019 13:49:32 +0000 Subject: [PATCH] Add smoke test for frontend commands This ensures that at least --help works for all the commands, preventing regressions like that in f3323a35d56bc1a833ee9140f2a90f948ba7f324. --- artiq/test/test_frontends.py | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 artiq/test/test_frontends.py diff --git a/artiq/test/test_frontends.py b/artiq/test/test_frontends.py new file mode 100644 index 000000000..adb209e54 --- /dev/null +++ b/artiq/test/test_frontends.py @@ -0,0 +1,35 @@ +"""Generic tests for frontend commands.""" +import subprocess +import sys +import unittest + + +class TestFrontends(unittest.TestCase): + def test_help(self): + """Test --help as a simple smoke test against catastrophic breakage.""" + commands = { + "aqctl": [ + "corelog", "korad_ka3005p", "lda", "novatech409b", + "thorlabs_tcube" + ], + "artiq": [ + "client", "compile", "coreanalyzer", "coremgmt", "ctlmgr", + "devtool", "flash", "influxdb", "master", "mkfs", "route", + "rpctool", "rtiomon", "run", "session" + ] + } + + # Skip tests for GUI programs on headless CI environments. + try: + from PyQt5 import QtGui, QtWidgets + commands["artiq"] += ["browser", "dashboard"] + except ImportError: + pass + + for module in (prefix + "_" + name + for prefix, names in commands.items() + for name in names): + subprocess.check_call( + [sys.executable, "-m", "artiq.frontend." + module, "--help"], + stdout=subprocess.DEVNULL, + stderr=subprocess.STDOUT)