Skip to content

Commit

Permalink
tests: move all requirement files to pyproject.toml
Browse files Browse the repository at this point in the history
Previously, the test-suite used requirement files for its test environments
instead of optional dependencies, specified in the pyproject.toml, because
GitHub Dependabot did not support these.

Support for this seems to be available now:

    https://github.blog/changelog/2022-10-24-dependabot-updates-support-for-the-python-pep-621-standard/

Signed-off-by: Florian Scherf <[email protected]>
  • Loading branch information
fscherf committed May 29, 2023
1 parent 5fe1fb1 commit fbf70cd
Show file tree
Hide file tree
Showing 9 changed files with 67 additions and 80 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ jobs:

- name: Install dependencies
run: |
pip install -U setuptools
pip install -r tests/REQUIREMENTS.lint.txt
pip install --upgrade setuptools tox
pip install .[lint]
- name: Run Tox
run: tox -e lint
Expand All @@ -48,8 +48,8 @@ jobs:

- name: Install dependencies
run: |
pip install -U setuptools
pip install -r tests/REQUIREMENTS.test.txt
pip install --upgrade setuptools tox
pip install .[test]
python -m playwright install
python -m playwright install-deps
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -274,5 +274,4 @@ tags
[._]*.un~

# End of https://www.toptal.com/developers/gitignore/api/python,vim,emacs,eclipse
/envs/
/doc/output
46 changes: 17 additions & 29 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,38 +1,26 @@
SHELL=/bin/bash
PYTHON=python3

PYTHON_ENV_ROOT=envs
PYTHON_DEV_ENV=$(PYTHON_ENV_ROOT)/$(PYTHON)-dev
PYTHON_PACKAGING_ENV=$(PYTHON_ENV_ROOT)/$(PYTHON)-packaging-env
PYTHON=python3.10
PYTHON_ENV=env

.PHONY: clean doc dist test ci-test lint isort shell freeze

# development environment #####################################################
$(PYTHON_DEV_ENV): REQUIREMENTS.dev.txt
rm -rf $(PYTHON_DEV_ENV) && \
$(PYTHON) -m venv $(PYTHON_DEV_ENV) && \
. $(PYTHON_DEV_ENV)/bin/activate && \
# python env ##################################################################
$(PYTHON_ENV): pyproject.toml
rm -rf $(PYTHON_ENV) && \
$(PYTHON) -m venv $(PYTHON_ENV) && \
. $(PYTHON_ENV)/bin/activate && \
pip install pip --upgrade && \
pip install -r ./REQUIREMENTS.dev.txt

# packaging environment #######################################################
$(PYTHON_PACKAGING_ENV): REQUIREMENTS.packaging.txt
rm -rf $(PYTHON_PACKAGING_ENV) && \
$(PYTHON) -m venv $(PYTHON_PACKAGING_ENV) && \
. $(PYTHON_PACKAGING_ENV)/bin/activate && \
pip install --upgrade pip && \
pip install .[packaging]
pip install -e .[dev,packaging]

# environment helper ##########################################################
clean:
rm -rf $(PYTHON_ENV_ROOT)
rm -rf $(PYTHON_ENV)

shell: | $(PYTHON_DEV_ENV)
. $(PYTHON_DEV_ENV)/bin/activate && \
shell: | $(PYTHON_ENV)
. $(PYTHON_ENV)/bin/activate && \
rlpython

freeze: | $(PYTHON_DEV_ENV)
. $(PYTHON_DEV_ENV)/bin/activate && \
freeze: | $(PYTHON_ENV)
. $(PYTHON_ENV)/bin/activate && \
pip freeze

# tests #######################################################################
Expand All @@ -49,11 +37,11 @@ isort:
./docker-compose run playwright tox -e isort $(args)

# packaging ###################################################################
dist: | $(PYTHON_PACKAGING_ENV)
. $(PYTHON_PACKAGING_ENV)/bin/activate && \
dist: | $(PYTHON_ENV)
. $(PYTHON_ENV)/bin/activate && \
rm -rf dist *.egg-info && \
python -m build
$(PYTHON) -m build

_release: dist
. $(PYTHON_PACKAGING_ENV)/bin/activate && \
. $(PYTHON_ENV)/bin/activate && \
twine upload --config-file ~/.pypirc.fscherf dist/*
2 changes: 0 additions & 2 deletions REQUIREMENTS.dev.txt

This file was deleted.

2 changes: 0 additions & 2 deletions REQUIREMENTS.packaging.txt

This file was deleted.

43 changes: 43 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,49 @@ packaging = [
"twine",
]

dev = [
"tox",
]

test = [
"aiohttp>=3,<4",
"jinja2",
"rlpython",
"typing-extensions",

"coverage==7.2.6",
"pytest==7.3.1",
"pytest-aiohttp==1.0.4",
"pytest-dependency==0.5.1",
"pytest-mock==3.10.0",
"pytest-timeout==2.1.0",
"playwright==1.34.0",
]

lint = [
"aiohttp>=3,<4",
"jinja2",
"rlpython",
"typing-extensions",

"coverage",
"flake8==6.0.0",
"flake8-2020==1.8.0",
"flake8-bugbear==23.5.9",
"flake8-commas==2.1.0",
"flake8-comprehensions==3.12.0",
"flake8-length==0.3.1",
"flake8-logging-format==0.9.0",
"flake8-mutable==1.2.0",
"flake8-noqa==1.3.1",
"flake8-pytest-style==1.7.2",
"flake8-quotes==3.3.2",
"flake8-use-fstring==1.4",
"mypy==1.3.0",
"isort==5.12.0",
"pytest==7.3.1",
]


[project.urls]
"Homepage" = "https://lona-web.org"
Expand Down
22 changes: 0 additions & 22 deletions tests/REQUIREMENTS.lint.txt

This file was deleted.

13 changes: 0 additions & 13 deletions tests/REQUIREMENTS.test.txt

This file was deleted.

10 changes: 3 additions & 7 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ envlist=lint,py37,py38,py39,py310,py311
[testenv]
passenv = PLAYWRIGHT_BROWSERS_PATH
ignore_errors=True

deps =
-r tests/REQUIREMENTS.test.txt
deps = .[test]

commands =
coverage erase
Expand All @@ -26,8 +24,7 @@ commands =
coverage html -d htmlcov

[testenv:lint]
deps =
-r tests/REQUIREMENTS.lint.txt
deps = .[lint]

commands =
flake8 --config=flake8.ini lona tests test_project test_script doc
Expand All @@ -37,8 +34,7 @@ commands =


[testenv:isort]
deps =
isort
deps = .[lint]

commands =
isort .

0 comments on commit fbf70cd

Please sign in to comment.