From 725398db3df240badd4342cf140f48c48ba3a7c2 Mon Sep 17 00:00:00 2001 From: Edward Date: Mon, 29 Jun 2026 10:39:33 -0500 Subject: [PATCH 1/2] Closes #7 --- test/test_python_version.py | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 test/test_python_version.py diff --git a/test/test_python_version.py b/test/test_python_version.py new file mode 100644 index 0000000..3567333 --- /dev/null +++ b/test/test_python_version.py @@ -0,0 +1,9 @@ +import sys + +EXPECT_PYTHON_VERSION = (3, 13) + +def test_python_version(): + """ Ensure python version in use matches the expected python version. """ + assert sys.version_info.major == EXPECT_PYTHON_VERSION[0] + assert sys.version_info.minor == EXPECT_PYTHON_VERSION[1] + From 0372ecb2fe46a9629d982218b8b7ba56bf7800e3 Mon Sep 17 00:00:00 2001 From: Edward Date: Mon, 29 Jun 2026 11:06:39 -0500 Subject: [PATCH 2/2] Update to .venv and add .python-version --- Makefile | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 18ec0f0..225e036 100644 --- a/Makefile +++ b/Makefile @@ -1,21 +1,27 @@ -VENV_PYTHON:=venv/bin/python +VENV_PYTHON:=.venv/bin/python SRCS:=$(shell find src tests -name '*.py') all: test -venv: requirements-test.in requirements.in +# `make python-version` is used by GitHub actions to echo +# the expected version of Python into .python-version +PYTHON_VERSION:=$(shell PYTHONPATH=tests python3 -c 'from test_python_version import EXPECT_PYTHON_VERSION as V; print(f"{V[0]}.{V[1]}")') +python-version: + @echo $(PYTHON_VERSION) + +.venv: requirements-test.in requirements.in rm -rf $@ - python -m venv venv + python -m venv .venv $(VENV_PYTHON) -m pip install -r $^ # Install dependencies from pyproject.toml $(VENV_PYTHON) -m pip install -e . -lint: venv .lint +lint: .venv .lint .lint: $(SRCS) $(TSCS) $(VENV_PYTHON) -m flake8 $? touch $@ -static: venv .static +static: .venv .static .static: $(SRCS) $(TSCS) echo "Code: $(SRCS)" echo "Test: $(TSCS)" @@ -25,7 +31,7 @@ static: venv .static autopep8: autopep8 --in-place $(SRCS) -unit: venv +unit: .venv $(VENV_PYTHON) -m pytest test: lint static unit @@ -36,4 +42,4 @@ clean: -find src -type d -name __pycache__ -exec rm -fr "{}" \; force-clean: clean - rm -rf venv + rm -rf .venv