Skip to content

Commit 871b029

Browse files
committed
Update package from template
1 parent f5dd7e1 commit 871b029

File tree

7 files changed

+65
-96
lines changed

7 files changed

+65
-96
lines changed

.github/workflows/ci.yaml

+8-22
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,17 @@
1+
---
12
name: Run tests
23

3-
on:
4+
on: # yamllint disable-line rule:truthy
45
push:
56
branches: ['main']
67
pull_request:
8+
workflow_dispatch:
79

810
jobs:
9-
setup:
10-
runs-on: ubuntu-latest
11-
outputs:
12-
strategy: ${{steps.load.outputs.strategy}}
13-
14-
steps:
15-
- uses: actions/checkout@v2
16-
with:
17-
repository: colcon/ci
18-
- id: load
19-
run: echo "::set-output name=strategy::$(echo $(cat strategy.json))"
20-
2111
pytest:
22-
needs: [setup]
23-
strategy: ${{fromJson(needs.setup.outputs.strategy)}}
24-
runs-on: ${{matrix.os}}
25-
12+
uses: colcon/ci/.github/workflows/pytest.yaml@main
13+
yamllint:
14+
runs-on: ubuntu-latest
2615
steps:
27-
- uses: actions/checkout@v2
28-
- uses: actions/setup-python@v2
29-
with:
30-
python-version: ${{matrix.python}}
31-
- uses: colcon/ci@v1
16+
- uses: actions/checkout@v4
17+
- run: yamllint -f github .

publish-python.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
artifacts:
23
- type: wheel
34
uploads:
@@ -8,9 +9,8 @@ artifacts:
89
config:
910
repository: dirk-thomas/colcon
1011
distributions:
11-
- ubuntu:bionic
1212
- ubuntu:focal
1313
- ubuntu:jammy
14-
- debian:stretch
15-
- debian:buster
16-
- debian:bullseye
14+
- ubuntu:noble
15+
- debian:bookworm
16+
- debian:trixie

setup.cfg

+25-19
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,7 @@ url = https://colcon.readthedocs.io
55
project_urls =
66
Changelog = https://github.com/colcon/colcon-ros-buildfarm/milestones?direction=desc&sort=due_date&state=closed
77
GitHub = https://github.com/colcon/colcon-ros-buildfarm/
8-
author = Scott K Logan
9-
author_email = [email protected]
10-
maintainer = Scott K Logan
11-
maintainer_email = [email protected]
8+
author_email = Scott K Logan <[email protected]>
129
classifiers =
1310
Development Status :: 3 - Alpha
1411
Environment :: Plugins
@@ -25,26 +22,26 @@ keywords = colcon
2522

2623
[options]
2724
install_requires =
28-
colcon-core
25+
colcon-core
2926
packages = find:
3027
zip_safe = true
3128

3229
[options.extras_require]
3330
test =
34-
flake8>=3.6.0
35-
flake8-blind-except
36-
flake8-builtins
37-
flake8-class-newline
38-
flake8-comprehensions
39-
flake8-deprecated
40-
flake8-docstrings
41-
flake8-import-order
42-
flake8-quotes
43-
pep8-naming
44-
pylint
45-
pytest
46-
pytest-cov
47-
scspell3k>=2.2
31+
flake8>=3.6.0
32+
flake8-blind-except
33+
flake8-builtins
34+
flake8-class-newline
35+
flake8-comprehensions
36+
flake8-deprecated
37+
flake8-docstrings
38+
flake8-import-order
39+
flake8-quotes
40+
pep8-naming
41+
pylint
42+
pytest
43+
pytest-cov
44+
scspell3k>=2.2
4845

4946
[tool:pytest]
5047
filterwarnings =
@@ -54,11 +51,20 @@ filterwarnings =
5451
ignore:SelectableGroups dict interface is deprecated::flake8
5552
ignore:Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated::pyreadline
5653
junit_suite_name = colcon-ros-buildfarm
54+
markers =
55+
flake8
56+
linter
5757

5858
[options.entry_points]
5959

6060
[flake8]
61+
extend_ignore =
62+
D100
63+
D104
6164
import-order-style = google
65+
per-file-ignores =
66+
test/**: D101,D102,D103,D104,D105,D107
67+
show_source = true
6268

6369
[coverage:run]
6470
source = colcon_ros_buildfarm

stdeb.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[colcon-ros-buildfarm]
22
No-Python2:
33
Depends3: python3-colcon-core
4-
Suite: bionic focal jammy stretch buster bullseye
4+
Suite: focal jammy noble bookworm trixie
55
X-Python3-Version: >= 3.6

test/spell_check.words

+3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
apache
22
buildfarm
33
colcon
4+
https
45
iterdir
6+
linter
57
pathlib
8+
pycqa
69
pytest
710
scott
811
scspell

test/test_flake8.py

+14-43
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,22 @@
1-
# Copyright 2016-2018 Dirk Thomas
1+
# Copyright 2018 Open Source Robotics Foundation, Inc.
22
# Licensed under the Apache License, Version 2.0
33

4-
import logging
5-
from pathlib import Path
4+
import os
5+
import subprocess
66
import sys
77

8-
from flake8 import LOG
9-
from flake8.api.legacy import get_style_guide
10-
11-
12-
# avoid debug and info messages from flake8 internals
13-
LOG.setLevel(logging.WARN)
8+
import pytest
149

1510

11+
@pytest.mark.flake8
12+
@pytest.mark.linter
1613
def test_flake8():
17-
style_guide = get_style_guide(
18-
extend_ignore=['D100', 'D104'],
19-
show_source=True,
20-
)
21-
style_guide_tests = get_style_guide(
22-
extend_ignore=['D100', 'D101', 'D102', 'D103', 'D104', 'D105', 'D107'],
23-
show_source=True,
24-
)
14+
# flake8 doesn't have a stable public API as of ver 6.1.0.
15+
# See: https://flake8.pycqa.org/en/latest/user/python-api.html
16+
# Calling through subprocess is the most stable way to run it.
2517

26-
stdout = sys.stdout
27-
sys.stdout = sys.stderr
28-
# implicitly calls report_errors()
29-
report = style_guide.check_files([
30-
str(Path(__file__).parents[1] / 'colcon_ros_buildfarm'),
31-
])
32-
report_tests = style_guide_tests.check_files([
33-
str(Path(__file__).parents[1] / 'test'),
34-
])
35-
sys.stdout = stdout
36-
37-
total_errors = report.total_errors + report_tests.total_errors
38-
if total_errors: # pragma: no cover
39-
# output summary with per-category counts
40-
print()
41-
if report.total_errors:
42-
report._application.formatter.show_statistics(report._stats)
43-
if report_tests.total_errors:
44-
report_tests._application.formatter.show_statistics(
45-
report_tests._stats)
46-
print(
47-
'flake8 reported {total_errors} errors'
48-
.format_map(locals()), file=sys.stderr)
49-
50-
assert not total_errors, \
51-
'flake8 reported {total_errors} errors'.format_map(locals())
18+
ret_code = subprocess.call(
19+
[sys.executable, '-m', 'flake8'],
20+
cwd=os.path.dirname(os.path.dirname(__file__)),
21+
)
22+
assert 0 == ret_code, 'flake8 found violations'

test/test_spell_check.py

+10-7
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@
44
from pathlib import Path
55

66
import pytest
7-
from scspell import Report
8-
from scspell import SCSPELL_BUILTIN_DICT
9-
from scspell import spell_check
10-
117

128
spell_check_words_path = Path(__file__).parent / 'spell_check.words'
139

@@ -18,7 +14,12 @@ def known_words():
1814
return spell_check_words_path.read_text().splitlines()
1915

2016

17+
@pytest.mark.linter
2118
def test_spell_check(known_words):
19+
from scspell import Report
20+
from scspell import SCSPELL_BUILTIN_DICT
21+
from scspell import spell_check
22+
2223
source_filenames = [Path(__file__).parents[1] / 'setup.py'] + \
2324
list(
2425
(Path(__file__).parents[1] / 'colcon_ros_buildfarm')
@@ -36,21 +37,23 @@ def test_spell_check(known_words):
3637

3738
unknown_word_count = len(report.unknown_words)
3839
assert unknown_word_count == 0, \
39-
'Found {unknown_word_count} unknown words: '.format_map(locals()) + \
40+
f'Found {unknown_word_count} unknown words: ' + \
4041
', '.join(sorted(report.unknown_words))
4142

4243
unused_known_words = set(known_words) - report.found_known_words
4344
unused_known_word_count = len(unused_known_words)
4445
assert unused_known_word_count == 0, \
45-
'{unused_known_word_count} words in the word list are not used: ' \
46-
.format_map(locals()) + ', '.join(sorted(unused_known_words))
46+
f'{unused_known_word_count} words in the word list are not used: ' + \
47+
', '.join(sorted(unused_known_words))
4748

4849

50+
@pytest.mark.linter
4951
def test_spell_check_word_list_order(known_words):
5052
assert known_words == sorted(known_words), \
5153
'The word list should be ordered alphabetically'
5254

5355

56+
@pytest.mark.linter
5457
def test_spell_check_word_list_duplicates(known_words):
5558
assert len(known_words) == len(set(known_words)), \
5659
'The word list should not contain duplicates'

0 commit comments

Comments
 (0)