Skip to content

Commit 361da89

Browse files
committed
feat(ci): test examples
Currently only some of them.
1 parent a5fcab7 commit 361da89

5 files changed

Lines changed: 58 additions & 11 deletions

File tree

.github/workflows/setup.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ jobs:
1010
runs-on: ubuntu-24.04
1111

1212
steps:
13-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
13+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1414
- name: Setup Python
15-
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
15+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
1616
with:
1717
python-version: 3.14
1818
- uses: astral-sh/setup-uv@803947b9bd8e9f986429fa0c5a41c367cd732b41 # v7.2.1
@@ -40,9 +40,9 @@ jobs:
4040
- "3.14"
4141

4242
steps:
43-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
43+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
4444
- name: Setup Python
45-
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
45+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
4646
with:
4747
python-version: ${{ matrix.python-version }}
4848
- name: Install Gammu x64
@@ -100,9 +100,9 @@ jobs:
100100
if: startsWith(github.ref, 'refs/tags/') && github.repository == 'gammu/python-gammu'
101101

102102
steps:
103-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
103+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
104104
- name: Download all the dists
105-
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7
105+
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
106106
with:
107107
path: dist/
108108
merge-multiple: true

.github/workflows/test.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ jobs:
2222
name: ${{ matrix.os }}, Python ${{ matrix.python-version }}
2323

2424
steps:
25-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
25+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2626
- name: Set up Python ${{ matrix.python-version }}
27-
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
27+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
2828
with:
2929
python-version: ${{ matrix.python-version }}
3030
- uses: astral-sh/setup-uv@803947b9bd8e9f986429fa0c5a41c367cd732b41 # v7.2.1
@@ -42,6 +42,11 @@ jobs:
4242
run: uv sync --all-extras --dev
4343
- name: Test
4444
run: uv run pytest --cov
45-
- uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5
45+
- name: Examples
46+
if: ${{ matrix.os == 'ubuntu-latest' }}
47+
run: |
48+
source .venv/bin/activate
49+
./examples/run-dummy.sh
50+
- uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
4651
with:
4752
name: ${{ matrix.os }}, Python ${{ matrix.python-version }}

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ include README.rst
44
include NEWS.rst
55
include include/*.h
66
recursive-include examples *.py
7+
recursive-include examples *.sh
78
recursive-include test *.py
89
recursive-include test/data/gammu-dummy *
910
include test/data/*.*

examples/filesystem_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,14 +239,14 @@ def main() -> None: # noqa: PLR0912, PLR0915, C901
239239
# Check DeleteFile
240240
print("\n\nExpectation: Deletion of cgi.jpg from memorycard")
241241
try:
242-
state_machine.DeleteFile(f"{args.folder}cgi.jpg")
242+
state_machine.DeleteFile(f"{args.folder}/cgi.jpg")
243243
print("Deleted")
244244
except gammu.ERR_FILENOTEXIST:
245245
print("Something is wrong ...")
246246

247247
# Check AddFolder
248248
print('\n\nExpectation: Creation of a folder on the memorycard "42alpha"')
249-
state_machine.AddFolder(args.folder), "42alpha"
249+
state_machine.AddFolder(args.folder, "42alpha")
250250

251251
# Check GetFolderListing again *wired*
252252
print("\n\nExpectation: Print properties of newly created folder")

examples/run-dummy.sh

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/bin/sh
2+
cd $(dirname $0)
3+
4+
TEST_DIR=$(mktemp -d)
5+
6+
7+
CONFIG_DIR="$TEST_DIR/gammu"
8+
CONFIG="$CONFIG_DIR/config"
9+
DUMMY="$TEST_DIR/gammu-dummy"
10+
LOG="$TEST_DIR/gammu.log"
11+
12+
cleanup() {
13+
if [ -f "$LOG" ] ; then
14+
cat "$LOG"
15+
fi
16+
rm -rf "$TEST_DIR"
17+
}
18+
19+
trap cleanup EXIT INT
20+
21+
mkdir -p "$CONFIG_DIR"
22+
cat > "$CONFIG" << EOT
23+
[gammu]
24+
model = dummy
25+
connection = none
26+
port = $DUMMY
27+
gammuloc = /dev/null
28+
logformat = textall
29+
logfile = $LOG
30+
EOT
31+
32+
cp -r ../test/data/gammu-dummy/ "$DUMMY"
33+
mkdir "$DUMMY/fs/test"
34+
find $TEST_DIR
35+
36+
37+
./filesystem_test.py --config "$CONFIG" --folder "test"
38+
39+
export XDG_CONFIG_HOME="$TEST_DIR"
40+
41+
./network_info.py

0 commit comments

Comments
 (0)