Skip to content

Commit

Permalink
Merge pull request #12706 from keymanapp/chore/linux/rename-tests
Browse files Browse the repository at this point in the history
chore(linux): rename test files
  • Loading branch information
ermshiperete authored Nov 27, 2024
2 parents 7832be9 + 7edda3b commit 06cd709
Show file tree
Hide file tree
Showing 23 changed files with 16 additions and 12 deletions.
4 changes: 4 additions & 0 deletions docs/linux/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ To just run the unit tests without integration tests, add the
It's also possible to only run the tests for one of the subprojects. You
can use `build.sh` in the subdirectory for that.

Unit tests should be named after the file/class they are testing and
follow the pattern `*.tests.<ext>` (e.g. `keymanutil.tests.c`) or
for Python `*_tests.py`.

### ibus-keyman

If you want to run the ibus-keyman tests with Wayland, you'll have to
Expand Down
2 changes: 1 addition & 1 deletion docs/linux/keyman-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ LANGUAGE=de ./km-config
"python.testing.unittestArgs": [
"-v",
"-s", "linux/keyman-config/tests",
"-p", "test_*.py"
"-p", "*_tests.py"
],
"python.testing.unittestEnabled": true,
```
Expand Down
2 changes: 1 addition & 1 deletion docs/settings/linux/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"request": "launch",
"name": "Launch ibus-keyman unit tests",
"target": "./keymanutil_tests",
"cwd": "${workspaceFolder}/linux/build/x86_64/debug/src/test",
"cwd": "${workspaceFolder}/linux/build/x86_64/debug/src/tests",
"valuesFormatting": "parseText",
"internalConsoleOptions": "openOnSessionStart",
"env": {
Expand Down
2 changes: 1 addition & 1 deletion docs/settings/linux/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"python.testing.unittestArgs": [
"-v",
"-s", "linux/keyman-config/tests",
"-p", "test_*.py"
"-p", "*_tests.py"
],
"python.testing.unittestEnabled": true,
"python.testing.pytestEnabled": false,
Expand Down
2 changes: 1 addition & 1 deletion linux/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ debianpackage/
*.tar.xz
*.tar.gz
*.dsc
help/reference/
docs/help/reference/

# Cached/auto-compiled Python bytecode
*.pyc
Expand Down
4 changes: 2 additions & 2 deletions linux/ibus-keyman/src/test/meson.build
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
keymanutil_sources = [
'keymanutil_tests.c',
'keymanutil.tests.c',
util_files,
]

Expand Down Expand Up @@ -55,7 +55,7 @@ print_kmp_test = executable(
bcp47_util_tests = executable(
'bcp47-util-tests',
sources: [
'bcp47util_tests.c',
'bcp47util.tests.c',
'../bcp47util.c'
],
dependencies: [ gtk, icu ],
Expand Down
12 changes: 6 additions & 6 deletions linux/keyman-config/run-tests.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
#!/bin/bash
PYTHONPATH=.:$PYTHONPATH
PYTHONPATH=.:${PYTHONPATH}

XDG_CONFIG_HOME=$(mktemp --directory)
export XDG_CONFIG_HOME

if [ -f /usr/libexec/ibus-memconf ]; then
if [[ -f /usr/libexec/ibus-memconf ]]; then
export GSETTINGS_BACKEND=keyfile
fi

if [ "$1" == "--coverage" ]; then
if [[ "$1" == "--coverage" ]]; then
coverage="-m coverage run --source=. --data-file=build/.coverage"
fi

if [ -n "$TEAMCITY_VERSION" ]; then
if [[ -n "${TEAMCITY_VERSION}" ]]; then
if ! pip3 list --format=columns | grep -q teamcity-messages; then
pip3 install teamcity-messages
fi
Expand All @@ -23,6 +23,6 @@ else
fi

# shellcheck disable=SC2086
python3 ${coverage:-} -m ${test_module:-} discover ${extra_opts:-} -s tests -p test_*.py
python3 ${coverage:-} -m "${test_module:-}" discover ${extra_opts:-} -s tests/ -p "*_tests.py"

rm -rf "$XDG_CONFIG_HOME"
rm -rf "${XDG_CONFIG_HOME}"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 06cd709

Please sign in to comment.