Skip to content

Commit

Permalink
Simplify dev testing setup.
Browse files Browse the repository at this point in the history
- Add dev dependencies to setup.cfg through requirements-dev.txt, to simpl
- Add support to test python versions locally with docker.
  • Loading branch information
sodul committed Jan 22, 2024
1 parent c4c71e0 commit 9069172
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 11 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ jobs:
- name: Install
run: |
python -m pip install --upgrade pip
pip install --upgrade -r requirements-optional.txt
pip install --upgrade -e .
pip install --upgrade .[dev]
- name: Format
run: black --check --diff green example
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Unreleased
#### Date TBD

- Cleanup test_runner.py to more modern Python style.
- Simplify green's dev testing setup.

# Version 4.0.0
#### 16 Jan 2024

Expand Down
12 changes: 9 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,19 @@ test: test-versions test-installed test-coverage
@echo "\n(test) completed\n"

test-local:
@pip3 install -r requirements-optional.txt
@pip3 install --upgrade -e .[dev]
@make test-installed
make test-versions
make test-coverage
@# test-coverage needs to be last in deps, don't clean after it runs!

test-on-containers: clean-silent
@# Run the tests on pristine containers to isolate us from the local environment.
@for version in 3.8 3.9 3.10 3.11 3.12.0; do \
docker run --rm -it -v `pwd`:/green python:$$version \
bash -c "python --version; cd /green && pip install -e .[dev] && ./g green" ; \
done

test-coverage:
@# Generate coverage files for travis builds (don't clean after this!)
@make clean-silent
Expand All @@ -40,10 +47,9 @@ test-installed:
@rm -rf venv-installed
@python3 -m venv venv-installed
@make clean-silent
source venv-installed/bin/activate; pip3 install -r requirements-optional.txt
source venv-installed/bin/activate; python3 setup.py sdist
tar zxvf dist/green-$(VERSION).tar.gz
source venv-installed/bin/activate; cd green-$(VERSION) && pip3 install .
source venv-installed/bin/activate; cd green-$(VERSION) && pip3 install --upgrade .[dev]
source venv-installed/bin/activate; green -vvvv green
@rm -rf venv-installed
@make clean-silent
Expand Down
6 changes: 6 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
black
# coverage[toml] needs to be listed explictly for python < 3.11.
coverage[toml]; python_full_version<="3.11.0a6"
django
mypy
testtools
5 changes: 0 additions & 5 deletions requirements-optional.txt

This file was deleted.

2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
colorama
coverage[toml]
coverage
lxml
setuptools
unidecode
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ install_requires = file:requirements.txt
include_package_data = True
packages = find:

[options.extras_require]
dev = file:requirements-dev.txt

[options.package_data]
green = VERSION, shell_completion.sh
Expand Down

0 comments on commit 9069172

Please sign in to comment.