Skip to content

Commit 443a79f

Browse files
authored
Refactor conformance test case ingestion (cloud-custodian#131)
* Refactor conformance test ingestion -- eliminate an old, clumsy process and replace with a single, clean operation. * Convert CI from poetry to uv * Refine dependencies, links, and code style per code review * Add specific failure code to noqa comments * Use wip.toml to specify test cases that must be marked @wip because the Python implementation lags behind the baseline Golang implementation. * Update docs and help for dev workflows * regenerate conformance tests with whitespace tweaks and @wip flags * regerenate docs with updates * fix Python 3.9 type union complaints * Move conformance test config docstring
1 parent 1dc4a20 commit 443a79f

File tree

145 files changed

+30605
-14020
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

145 files changed

+30605
-14020
lines changed

.github/workflows/ci.yaml

Lines changed: 9 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,12 @@ jobs:
1212
runs-on: ubuntu-latest
1313
steps:
1414
- uses: actions/checkout@v2
15-
- uses: actions/setup-python@v1
15+
16+
- uses: astral-sh/setup-uv@v6
1617
with:
1718
python-version: ${{ env.DEFAULT_PY_VERSION }}
18-
- name: Linting
19-
env:
20-
RUFF_OUTPUT_FORMAT: github
21-
run: |
22-
pip install ruff
23-
ruff check src
19+
20+
- run: uv run tox -e lint
2421

2522
Tests:
2623
needs: Lint
@@ -41,48 +38,26 @@ jobs:
4138

4239
steps:
4340
- uses: actions/checkout@v2
44-
- name: Install poetry
45-
shell: bash
46-
run: pipx install poetry==${{ env.POETRY_VERSION }}
4741

48-
- name: Set up Python ${{ matrix.python-version }}
49-
uses: actions/setup-python@v1
42+
- uses: astral-sh/setup-uv@v6
5043
with:
5144
python-version: ${{ matrix.python-version }}
5245

53-
- name: Install Test Runner
54-
run: |
55-
python -m pip install --upgrade pip
56-
pip install tox
57-
58-
- name: Install Deps
59-
run: |
60-
tox -e ${{ matrix.tox-target }} --notest
61-
62-
- name: Test
63-
run: |
64-
tox -e ${{ matrix.tox-target }}
46+
- run: uv run tox -e ${{ matrix.tox-target }}
6547

6648
Coverage:
6749
needs: Tests
6850
runs-on: ubuntu-latest
6951
steps:
7052
- uses: actions/checkout@v2
71-
- name: Install poetry
72-
shell: bash
73-
run: pipx install poetry==${{ env.POETRY_VERSION }}
7453

75-
- uses: actions/setup-python@v1
54+
- uses: astral-sh/setup-uv@v6
7655
with:
7756
python-version: ${{ env.DEFAULT_PY_VERSION }}
7857

79-
- name: Install Test Runner
80-
run: |
81-
python -m pip install --upgrade pip
82-
pip install tox
58+
- run: uv run tox -e lint
8359

84-
- name: Upload Code Coverage
85-
uses: codecov/codecov-action@v4
60+
- uses: codecov/codecov-action@v4
8661
with:
8762
files: ./coverage.xml
8863
name: codecov

Makefile

Lines changed: 85 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -13,45 +13,107 @@
1313
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1414
# See the License for the specific language governing permissions and limitations under the License.
1515

16-
# Tools require GO. Typically, the following kinds of setup is required.
17-
# export PATH="/usr/local/go/bin:/usr/local/bin:$PATH"
18-
# export GOPATH="~/go"
16+
HELP_TEXT := ""
17+
HELP_TEXT += "Available commands:\n"
1918

19+
.PHONY: help
20+
help:
21+
@echo $(HELP_TEXT)
22+
23+
HELP_TEXT += " build runs ``uv build`` to create a distribution kit\n"
24+
.PHONY: build
2025
build:
2126
uv build
2227

23-
install-tools:
24-
cd tools && docker pull golang && docker build -t mkgherkin .
28+
HELP_TEXT += " build-all alias of build, conformance, and docs\n"
29+
.PHONY: build-all
30+
build-all:
31+
$(MAKE) build
32+
$(MAKE) conformance
33+
$(MAKE) docs
2534

26-
test:
27-
cd features && $(MAKE) all
28-
tox run -e py312
35+
HELP_TEXT += "\n"
2936

30-
test-all:
31-
cd features && $(MAKE) all
32-
tox run
37+
HELP_TEXT += " test runs the Python 3.12 test environment to execute a quick test\n"
38+
.PHONY: test
39+
test: conformance
40+
uv run tox run -e py312
41+
42+
HELP_TEXT += " test-all runs the full test suite\n"
43+
.PHONY: test-all
44+
test-all: conformance
45+
uv run tox run
3346

34-
test-wip:
47+
HELP_TEXT += " test-<env> runs tests for any of the available tox environments:\n"
48+
HELP_TEXT += "\n$$(uv run tox list | awk '{ print " " $$0 }')\n"
49+
.PHONY: test-%
50+
test-%: conformance
51+
uv run tox run -e $*
52+
53+
HELP_TEXT += "\n"
54+
55+
HELP_TEXT += " conformance generates conformance tests\n"
56+
.PHONY: conformance
57+
conformance:
3558
cd features && $(MAKE) all
36-
tox run -e wip
3759

38-
test-tools:
39-
tox run -e tools
40-
cd features && $(MAKE) scan
60+
HELP_TEXT += " conf-clean cleans generated conformance tests\n"
61+
.PHONY: conf-clean
62+
conf-clean:
63+
cd features && $(MAKE) clean
64+
65+
HELP_TEXT += "\n"
4166

67+
HELP_TEXT += " docs generates HTML documentation\n"
68+
.PHONY: docs
4269
docs: $(wildcard docs/source/*.rst)
43-
PYTHONPATH=src python -m doctest docs/source/*.rst
44-
export PYTHONPATH=$(PWD)/src:$(PWD)/tools && cd docs && $(MAKE) html
70+
$(MAKE) docs-lint
71+
cd docs && $(MAKE) html
4572

73+
HELP_TEXT += " docs-clean lints documentation sources\n"
74+
.PHONY: docs-lint
75+
docs-lint:
76+
uv run python -m doctest docs/source/*.rst
77+
78+
HELP_TEXT += " docs-clean cleans generated HTML documentation\n"
79+
.PHONY: docs-clean
80+
docs-clean:
81+
cd docs && $(MAKE) clean
82+
83+
HELP_TEXT += "\n"
84+
85+
HELP_TEXT += " lint runs code coverage, type hint checking, and other lint checks\n"
86+
HELP_TEXT += " (alias of test-lint)\n"
87+
.PHONY: lint
4688
lint:
47-
tox run -e lint
89+
uv run tox run -e lint
4890

91+
HELP_TEXT += "\n"
92+
93+
HELP_TEXT += " format runs code formatting\n"
94+
.PHONY: format
95+
format:
96+
uv run ruff format src tools
97+
98+
HELP_TEXT += " coverage generates code coverage reports\n"
99+
.PHONY: coverage
49100
coverage:
50-
coverage report -m
101+
uv run tox run -e coverage
51102

103+
HELP_TEXT += " clean cleans all content ignored by git\n"
104+
.PHONY: clean
52105
clean:
53-
rm -rf .tox .Python bin include lib pip-selfcheck.json
106+
git clean -Xfd
107+
108+
HELP_TEXT += " clean-all alias of clean, conformance-clean, and docs-clean\n"
109+
.PHONY: clean-all
110+
clean-all:
111+
$(MAKE) clean
112+
$(MAKE) test-clean
113+
$(MAKE) docs-clean
54114

115+
HELP_TEXT += " benchmarks runs performance benchmarks\n"
116+
.PHONY: benchmarks
55117
benchmarks:
56-
PYTHONPATH=src python benches/large_resource_set.py TagAssetBenchmark
57-
PYTHONPATH=src python benches/complex_expression.py
118+
PYTHONPATH=src uv run python benches/large_resource_set.py TagAssetBenchmark
119+
PYTHONPATH=src uv run python benches/complex_expression.py

docs/Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@
77
# You can set these variables from the command line, and also
88
# from the environment for the first two.
99
SPHINXOPTS ?=
10-
SPHINXBUILD ?= sphinx-build
10+
SPHINXBUILD ?= uv run sphinx-build
1111
SOURCEDIR = source
1212
BUILDDIR = build
1313

14+
export GRAPHVIZ_DOT ?= $(shell which dot)
15+
1416
# Put it first so that "make" without argument is like "make help".
1517
help:
1618
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
@@ -20,4 +22,6 @@ help:
2022
# Catch-all target: route all unknown targets to Sphinx using the new
2123
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
2224
%: Makefile
25+
@which java || (>&2 echo "Building docs requires java" ; exit 1)
26+
@which dot || (>&2 echo "Building docs requires graphviz (specifically, the dot executable)" ; exit 1)
2327
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/build/doctrees/api.doctree

34.9 KB
Binary file not shown.
19 Bytes
Binary file not shown.

docs/build/doctrees/cli.doctree

19 Bytes
Binary file not shown.
35 Bytes
Binary file not shown.
-25.2 KB
Binary file not shown.

docs/build/doctrees/index.doctree

19 Bytes
Binary file not shown.
35 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)