From 684d1016cac800c234d107a2d0ef1bc2e7cad2c9 Mon Sep 17 00:00:00 2001 From: Tomas Janousek Date: Wed, 29 Nov 2023 23:48:45 +0000 Subject: [PATCH] Render template ../cookiecutter-python-cli at 50bb7eef5d --- .github/workflows/check.yaml | 8 ++++---- .gitignore | 1 + Makefile | 20 ++++++++++--------- README.md | 4 ++-- pyproject.toml | 3 +++ tests/cram-noescape.py | 8 ++++++++ tests/fixme.md | 10 ++++++++++ {.readme.md => tests}/include.py | 0 {.readme.md => tests/readme}/config-sample.md | 0 {.readme.md => tests/readme}/help.md | 0 10 files changed, 39 insertions(+), 15 deletions(-) create mode 100755 tests/cram-noescape.py create mode 100644 tests/fixme.md rename {.readme.md => tests}/include.py (100%) rename {.readme.md => tests/readme}/config-sample.md (100%) rename {.readme.md => tests/readme}/help.md (100%) diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml index d31a00e..ca62fed 100644 --- a/.github/workflows/check.yaml +++ b/.github/workflows/check.yaml @@ -71,8 +71,8 @@ jobs: uses: liskin/gh-problem-matcher-wrap@v2 with: linters: pytest - run: make test - - name: readme + run: make test-pytest + - name: cram, readme run: make readme - name: check-wheel run: make check-wheel @@ -139,8 +139,8 @@ jobs: uses: liskin/gh-problem-matcher-wrap@v2 with: linters: pytest - run: make test - - name: readme + run: make test-pytest + - name: cram, readme run: make readme - name: check-wheel run: make check-wheel diff --git a/.gitignore b/.gitignore index 0764840..ac68fed 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ *.egg-info/ +*.md.err /.*_cache/ /.venv/ /build/ diff --git a/Makefile b/Makefile index f9fe417..c82613a 100644 --- a/Makefile +++ b/Makefile @@ -48,26 +48,28 @@ lint-isort: $(VENV_DONE) $(VENV_PYTHON) -m isort --check $(LINT_SOURCES) .PHONY: test -test: $(VENV_DONE) +test: test-pytest test-cram + +.PHONY: test-pytest +test-pytest: $(VENV_DONE) $(VENV_PYTHON) -m pytest $(PYTEST_FLAGS) tests/ .PHONY: readme readme: README.md git diff --exit-code $^ -CRAM_TARGETS := $(wildcard .readme.md/*.md) - -.PHONY: $(CRAM_TARGETS) -$(CRAM_TARGETS) &: CRAM_INTERACTIVE=$(shell [ -t 0 ] && echo --interactive) -$(CRAM_TARGETS) &: $(VENV_DONE) +.PHONY: test-cram +test-cram: CRAM_INTERACTIVE=$(shell [ -t 0 ] && echo --interactive) +test-cram: $(VENV_DONE) PATH="$(CURDIR)/$(VENV)/bin:$$PATH" \ XDG_DATA_HOME=/home/user/.local/share \ XDG_CONFIG_HOME=/home/user/.config \ - $(VENV_PYTHON) -m cram --indent=4 $(CRAM_INTERACTIVE) $(CRAM_TARGETS) + $(VENV_PYTHON) tests/cram-noescape.py --indent=4 --shell=/bin/bash $(CRAM_INTERACTIVE) \ + $(wildcard tests/*.md tests/*/*.md tests/*/*/*.md) .PHONY: README.md -README.md: $(CRAM_TARGETS) - .readme.md/include.py < $@ > $@.tmp +README.md: test-cram + tests/include.py < $@ > $@.tmp mv -f $@.tmp $@ .PHONY: dist diff --git a/README.md b/README.md index c805e40..42506e1 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ pip install strava-offline ## Usage - + $ strava-offline --help Usage: strava-offline [OPTIONS] @@ -58,7 +58,7 @@ which is located at `~/.config/strava_offline/config.yaml` by default Sample config file can be generated using the `--config-sample` flag: - + $ strava-offline --config-sample diff --git a/pyproject.toml b/pyproject.toml index 05d8afc..62db1be 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -85,4 +85,7 @@ show_error_codes = true [tool.isort] profile = "open_stack" +[tool.ruff] +line-length = 120 + # vim:set et: diff --git a/tests/cram-noescape.py b/tests/cram-noescape.py new file mode 100755 index 0000000..31a41de --- /dev/null +++ b/tests/cram-noescape.py @@ -0,0 +1,8 @@ +#!/usr/bin/env python3 + +import runpy + +import cram # type: ignore [import] + +cram._test._needescape = lambda _: False +runpy.run_module('cram') diff --git a/tests/fixme.md b/tests/fixme.md new file mode 100644 index 0000000..0056eda --- /dev/null +++ b/tests/fixme.md @@ -0,0 +1,10 @@ +Common invocation flags: + + $ function strava-offline { + > command strava-offline -- "$@" + > } + +Nothing: + + $ strava-offline < END diff --git a/.readme.md/include.py b/tests/include.py similarity index 100% rename from .readme.md/include.py rename to tests/include.py diff --git a/.readme.md/config-sample.md b/tests/readme/config-sample.md similarity index 100% rename from .readme.md/config-sample.md rename to tests/readme/config-sample.md diff --git a/.readme.md/help.md b/tests/readme/help.md similarity index 100% rename from .readme.md/help.md rename to tests/readme/help.md