Skip to content

Commit da05b12

Browse files
authored
chore: sync templated files to newest template version (#27)
2 parents cba9fb4 + d19c62f commit da05b12

12 files changed

Lines changed: 117 additions & 39 deletions

File tree

.copier/answers_pypackage.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# files using the answers stored in this file.
66
# (see https://copier.readthedocs.io/en/stable/updating/ for details)
77

8-
_commit: v0.2.1
8+
_commit: v0.3.2
99
_src_path: https://github.com/feeph/pypackage-template
1010
author_email: 55798703+feeph@users.noreply.github.com
1111
author_name: Feeph Aifeimei

.github/workflows/coveralls.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
#
3+
# https://coveralls.io/
4+
#
5+
6+
name: update coverage report (coveralls)
7+
8+
on:
9+
pull_request:
10+
push:
11+
branches:
12+
- master
13+
14+
jobs:
15+
coverage:
16+
name: generate coverage report
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: checkout repository
20+
uses: actions/checkout@v4
21+
- name: configure Python (using PDM)
22+
uses: pdm-project/setup-pdm@v4
23+
with:
24+
python-version-file: pyproject.toml
25+
- name: install dependencies
26+
run: |
27+
pdm install
28+
- name: generate coverage report
29+
run: |
30+
pdm run coverage run --source=feeph.i2cmux -m pytest tests/
31+
# coveralls recognizes the presence of .coverage but claims there
32+
# is nothing to report; creating a report in lcov format fixes that
33+
mkdir -p coverage
34+
pdm run coverage-lcov --output_file_path=coverage/lcov.info
35+
- name: coveralls action
36+
uses: coverallsapp/github-action@v2

.github/workflows/validate-code.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
name: verify pull request
88

99
on:
10-
push:
10+
pull_request:
1111

1212
# our tox configuration leverages pyenv to test on multiple Python versions.
1313
# It is unclear if we can leverage actions/setup-python@v4 to do the same.

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
[![Copier](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/copier-org/copier/master/img/badge/badge-grayscale-inverted-border-purple.json)](https://github.com/copier-org/copier)
44
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit)
5+
[![Coverage Status](https://coveralls.io/repos/github/feeph/libi2cmux-python/badge.svg)](https://coveralls.io/github/feeph/libi2cmux-python)
56
[![pdm-managed](https://img.shields.io/endpoint?url=https%3A%2F%2Fcdn.jsdelivr.net%2Fgh%2Fpdm-project%2F.github%2Fbadge.json)](https://pdm-project.org)
67
[![tox](https://img.shields.io/badge/tox-ab79d2)](https://tox.wiki/)
78

feeph/i2cmux/generic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def __exit__(self, exc_type, exc_value, exc_tb):
9191
LH.debug("[%d] I²C I/O burst completed after %d ms.", id(self), elapsed_ns / (1000 * 1000))
9292
# -----------------------------------------------------------------
9393
# send I²C command to reset the TCA9548A?
94-
self._i2c_bus.writeto(self._tca_adr, b"\x00")
94+
self._i2c_bus.writeto(self._tca_adr, bytearray([0x00]))
9595
# -----------------------------------------------------------------
9696
LH.debug("[%d] Releasing the lock on the I²C bus.", id(self))
9797
self._i2c_bus.unlock()

pdm.lock

Lines changed: 35 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,14 @@ dev = [
9494
"types-PyYAML>=6.0.12.20240311",
9595
]
9696
tools = [
97-
"autopep8 ~= 2.2",
98-
"copier ~= 9.3",
99-
"flake8 ~= 7.0",
100-
"mypy ~= 1.10",
101-
"pylint ~= 3.2",
102-
"pytest-cov ~= 5.0",
103-
"pytest-sugar ~= 1.0",
97+
"autopep8 ~= 2.2",
98+
"copier ~= 9.3",
99+
"coverage-lcov ~= 0.3",
100+
"flake8 ~= 7.0",
101+
"mypy ~= 1.10",
102+
"pylint ~= 3.2",
103+
"pytest-cov ~= 5.0",
104+
"pytest-sugar ~= 1.0",
104105
]
105106

106107
# during development: fetch all packages in our namespace from TestPyPI

requirements-dev.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ astroid==3.2.4 \
1010
autopep8==2.3.1 \
1111
--hash=sha256:8d6c87eba648fdcfc83e29b788910b8643171c395d9c4bcf115ece035b9c9dda \
1212
--hash=sha256:a203fe0fcad7939987422140ab17a930f684763bf7335bdb6709991dd7ef6c2d
13+
click==8.1.7 \
14+
--hash=sha256:ae74fb96c20a0277a1d615f1e4d73c8414f5a98db8b799a7931d1582f3390c28 \
15+
--hash=sha256:ca9853ad459e787e2192211578cc907e7594e294c7ccc834310722b41b9ca6de
1316
colorama==0.4.6 \
1417
--hash=sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44 \
1518
--hash=sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6
@@ -49,6 +52,9 @@ coverage==7.6.1 \
4952
--hash=sha256:f5796e664fe802da4f57a168c85359a8fbf3eab5e55cd4e4569fbacecc903959 \
5053
--hash=sha256:fc5a77d0c516700ebad189b587de289a20a78324bc54baee03dd486f0855d234 \
5154
--hash=sha256:fd21f6ae3f08b41004dfb433fa895d858f3f5979e7762d052b12aef444e29afc
55+
coverage-lcov==0.3.0 \
56+
--hash=sha256:0b352da0c72eacd555de2e10fa75ec165b8849ab6827218abc3ef6be2ec861f6 \
57+
--hash=sha256:23ae34a535f1ed3fa4cdf9682f6c1fe1a40aa98c94aa05614512dbf2da82e749
5258
coverage[toml]==7.6.1 \
5359
--hash=sha256:07e2ca0ad381b91350c0ed49d52699b625aab2b44b65e1b4e02fa9df0e92ad2d \
5460
--hash=sha256:0c0420b573964c760df9e9e86d1a9a622d0d27f417e1a949a8a66dd7bcee7bc6 \

requirements.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ adafruit-pureio==1.1.11 \
2828
binho-host-adapter==0.1.6 \
2929
--hash=sha256:1e6da7a84e208c13b5f489066f05774bff1d593d0f5bf1ca149c2b8e83eae856 \
3030
--hash=sha256:f71ca176c1e2fc1a5dce128beb286da217555c6c7c805f2ed282a6f3507ec277
31-
feeph-i2c==0.7.3 \
32-
--hash=sha256:5a1937c4fcc4a7820e64b4195077d8a36e99430382b0e5dc291ed79ac053e53c \
33-
--hash=sha256:f5cf7c7090861fe9cc6c385bb41e22f7fb97f5e6896c013ce4ab7115939246ef
31+
feeph-i2c==0.7.4 \
32+
--hash=sha256:57e64801d6f6f1eeca8313da0299ad59bd04b3d1d007470f1c9912377aef6669 \
33+
--hash=sha256:cc6963d746bed5500ee9d7f43f979a51c9f10bede3e273276df1dee8dcae8b34
3434
gpiod==2.2.1 \
3535
--hash=sha256:51ba8e0e92e9b986b1d7aa4071617b3948d4fc69bfdef68e7d8b94aec8e56e54 \
3636
--hash=sha256:5fd077dc8933eeb1be2da78980aa4c53812119a6773d73060c7b5a1e30886373 \

scripts/run_tests

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,25 @@ if [[ -n $FILES ]] ; then
2323
pdm run mypy $FILES
2424
fi
2525

26+
# Generate a coverage report in lcov format even if pytest fails due to
27+
# lacking coverage. The report can then be used by an IDE to indicate
28+
# coverage directly in your editor window. Special care must be taken
29+
# when working on code that isn't covered by unit tests.
30+
#
31+
# recommended extension for VS Code:
32+
# https://marketplace.visualstudio.com/items?itemName=markis.code-coverage
33+
generate_lcov() {
34+
mkdir -p coverage
35+
# generate coverage report in lcov and HTML format
36+
pdm run coverage-lcov --output_file_path=coverage/lcov.info
37+
pdm run coverage html
38+
}
39+
40+
trap generate_lcov EXIT
41+
pdm run pytest --cov=feeph.i2cmux --cov-report=term-missing --no-header --quiet tests/
42+
43+
tox
44+
2645
echo "----------------------------------------------------------------------"
2746
echo "If you reached this far you passed. Congratulations!"
2847
echo "----------------------------------------------------------------------"

0 commit comments

Comments
 (0)