Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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)"
Expand All @@ -25,7 +31,7 @@ static: venv .static
autopep8:
autopep8 --in-place $(SRCS)

unit: venv
unit: .venv
$(VENV_PYTHON) -m pytest

test: lint static unit
Expand All @@ -36,4 +42,4 @@ clean:
-find src -type d -name __pycache__ -exec rm -fr "{}" \;

force-clean: clean
rm -rf venv
rm -rf .venv
9 changes: 9 additions & 0 deletions test/test_python_version.py
Original file line number Diff line number Diff line change
@@ -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]