You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
input-remapper/tests/test.py

45 lines
1.6 KiB
Python

#!/usr/bin/python3
# -*- coding: utf-8 -*-
# setxkbmap-gtk - GTK based GUI for device specific keyboard mappings
# Copyright (C) 2020 sezanzeb <proxima@hip70890b.de>
#
# This file is part of setxkbmap-gtk.
#
# setxkbmap-gtk is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# setxkbmap-gtk is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with setxkbmap-gtk. If not, see <https://www.gnu.org/licenses/>.
"""Sets up setxkbmap-gtk for the tests and runs them."""
import sys
import unittest
if __name__ == "__main__":
modules = sys.argv[1:]
# discoverer is really convenient, but it can't find a specific test
# in all of the available tests like unittest.main() does...,
# so provide both options.
if len(modules) > 0:
# for example `tests/test.py ConfigTest.testFirstLine`
testsuite = unittest.defaultTestLoader.loadTestsFromNames(
[f'testcases.{module}' for module in modules]
)
else:
# run all tests by default
testsuite = unittest.defaultTestLoader.discover(
'testcases', pattern='*.py'
)
testrunner = unittest.TextTestRunner(verbosity=1).run(testsuite)