Skip to content

Commit

Permalink
Update mxdev setup and add python 3.12 to tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rnixx committed Feb 5, 2024
1 parent 187c4b8 commit 1804252
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 33 deletions.
11 changes: 5 additions & 6 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: Test yafowil
name: Tests

on:
push:
on: [push]

jobs:
test:
Expand All @@ -22,18 +21,18 @@ jobs:
- "3.9"
- "3.10"
- "3.11"
- "3.12"

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}

- name: Install
run: |
pip install wheel coverage
pip install -e .[test]
- name: Run tests
Expand Down
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
*.egg-info
*.pyc
*.pyo
/.coverage
/.mxmake/
/.mxmake
/.ruff_cache
/build
/dist/
/htmlcov/
/requirements-mxdev.txt
/venv/
/venv
34 changes: 27 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ RUN_TARGET?=
# No default value.
CLEAN_FS?=

# Optional makefile to include before default targets. This can
# be used to provide custom targets or hook up to existing targets.
# Default: include.mk
INCLUDE_MAKEFILE?=include.mk

## core.mxenv

# Python interpreter to use.
Expand Down Expand Up @@ -58,12 +63,12 @@ VENV_CREATE?=true
VENV_FOLDER?=venv

# mxdev to install in virtual environment.
# Default: https://github.com/mxstack/mxdev/archive/main.zip
MXDEV?=https://github.com/mxstack/mxdev/archive/main.zip
# Default: mxdev
MXDEV?=mxdev

# mxmake to install in virtual environment.
# Default: https://github.com/mxstack/mxmake/archive/develop.zip
MXMAKE?=https://github.com/mxstack/mxmake/archive/develop.zip
# Default: mxmake
MXMAKE?=mxmake

## core.mxfiles

Expand All @@ -76,7 +81,7 @@ PROJECT_CONFIG?=mx.ini
# The command which gets executed. Defaults to the location the
# :ref:`run-tests` template gets rendered to if configured.
# Default: .mxmake/files/run-tests.sh
TEST_COMMAND?=.mxmake/files/run-tests.sh
TEST_COMMAND?=$(VENV_FOLDER)/bin/python -m yafowil.tests.__init__

# Additional Python requirements for running tests to be
# installed (via pip).
Expand All @@ -92,7 +97,11 @@ TEST_DEPENDENCY_TARGETS?=
# The command which gets executed. Defaults to the location the
# :ref:`run-coverage` template gets rendered to if configured.
# Default: .mxmake/files/run-coverage.sh
COVERAGE_COMMAND?=.mxmake/files/run-coverage.sh
COVERAGE_COMMAND?=\
$(VENV_FOLDER)/bin/coverage run \
--source src/yafowil \
-m yafowil.tests.__init__ \
&& $(VENV_FOLDER)/bin/coverage report --fail-under=99

## i18n.gettext

Expand All @@ -104,7 +113,7 @@ GETTEXT_LOCALES_PATH?=src/yafowil/i18n/locales
# No default value.
GETTEXT_DOMAIN?=yafowil

# List of language identifiers.
# Space separated list of language identifiers.
# No default value.
GETTEXT_LANGUAGES?=en de

Expand All @@ -127,6 +136,7 @@ DIRTY_TARGETS?=
CLEAN_TARGETS?=
PURGE_TARGETS?=
CHECK_TARGETS?=
TYPECHECK_TARGETS?=
FORMAT_TARGETS?=

# Defensive settings for make: https://tech.davis-hansson.com/p/make/
Expand Down Expand Up @@ -179,8 +189,10 @@ endif
MXENV_TARGET:=$(SENTINEL_FOLDER)/mxenv.sentinel
$(MXENV_TARGET): $(SENTINEL)
ifeq ("$(VENV_ENABLED)", "true")
ifeq ("$(VENV_CREATE)", "true")
@echo "Setup Python Virtual Environment under '$(VENV_FOLDER)'"
@$(PYTHON_BIN) -m venv $(VENV_FOLDER)
endif
endif
@$(MXENV_PATH)pip install -U pip setuptools wheel
@$(MXENV_PATH)pip install -U $(MXDEV)
Expand All @@ -197,7 +209,9 @@ mxenv-dirty:
.PHONY: mxenv-clean
mxenv-clean: mxenv-dirty
ifeq ("$(VENV_ENABLED)", "true")
ifeq ("$(VENV_CREATE)", "true")
@rm -rf $(VENV_FOLDER)
endif
else
@$(MXENV_PATH)pip uninstall -y $(MXDEV)
@$(MXENV_PATH)pip uninstall -y $(MXMAKE)
Expand Down Expand Up @@ -245,6 +259,7 @@ $(FILES_TARGET): $(PROJECT_CONFIG) $(MXENV_TARGET) $(SOURCES_TARGET) $(LOCAL_PAC
$(call set_mxfiles_env,$(MXENV_PATH),$(MXMAKE_FILES))
@$(MXENV_PATH)mxdev -n -c $(PROJECT_CONFIG)
$(call unset_mxfiles_env,$(MXENV_PATH),$(MXMAKE_FILES))
@test -e $(MXMAKE_FILES)/pip.conf && cp $(MXMAKE_FILES)/pip.conf $(VENV_FOLDER)/pip.conf || :
@touch $(FILES_TARGET)

.PHONY: mxfiles
Expand Down Expand Up @@ -432,6 +447,8 @@ INSTALL_TARGETS+=$(LINGUA_TARGET)
DIRTY_TARGETS+=lingua-dirty
CLEAN_TARGETS+=lingua-clean

-include $(INCLUDE_MAKEFILE)

##############################################################################
# Default targets
##############################################################################
Expand Down Expand Up @@ -471,5 +488,8 @@ runtime-clean:
.PHONY: check
check: $(CHECK_TARGETS)

.PHONY: typecheck
typecheck: $(TYPECHECK_TARGETS)

.PHONY: format
format: $(FORMAT_TARGETS)
17 changes: 0 additions & 17 deletions mx.ini
Original file line number Diff line number Diff line change
@@ -1,19 +1,2 @@
[settings]
main-package = -e .[test]

mxmake-templates =
run-tests
run-coverage

mxmake-test-path = src
mxmake-source-path = src/yafowil
mxmake-omit-path = src/yafowil/tests/__init__.py

[mxmake-env]
TESTRUN_MARKER = 1

[mxmake-run-tests]
environment = env

[mxmake-run-coverage]
environment = env
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,13 @@ def run_tests(self):
'webresource'
],
tests_require=[
'coverage',
'lxml',
'zope.testrunner'
],
test_suite='yafowil.tests.test_suite',
extras_require=dict(test=[
'coverage',
'lxml',
'zope.testrunner'
]),
Expand Down

0 comments on commit 1804252

Please sign in to comment.