Skip to content

Commit

Permalink
lsp: Use hatch's new test command
Browse files Browse the repository at this point in the history
  • Loading branch information
alcarney committed May 9, 2024
1 parent 2115ebd commit 5a74041
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 82 deletions.
7 changes: 2 additions & 5 deletions .github/workflows/lsp-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,11 @@ jobs:

- run: |
python --version
python -m pip install --upgrade pip
python -m pip install --upgrade tox
python -m pip install --upgrade hatch
name: Setup Environment
- run: |
cd lib/esbonio
version=$(echo ${{ matrix.python-version }} | tr -d .)
python -m tox run -e `tox -l | grep $version | tr '\n' ','`
shell: bash
hatch test -i py=${{ matrix.python-version }}
name: Run Tests
1 change: 1 addition & 0 deletions lib/esbonio/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.coverage*
result
12 changes: 10 additions & 2 deletions lib/esbonio/Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
include ../../.devcontainer/tools.mk

.PHONY: dist

# Global flags to pass to hatch, e.g. -v, --no-color etc.
HATCH_ARGS =

.PHONY: dist release test

dist: $(HATCH)
$(HATCH) build
$(HATCH) $(HATCH_ARGS) build

test: ARGS ?= -i py=$(shell $(PY) -c 'import sys;v=sys.version_info;print(f"{v.major}.{v.minor}")')
test: $(HATCH) $(PY)
$(HATCH) $(HATCH_ARGS) test $(ARGS)

release: $(TOWNCRIER) $(HATCH) $(PY)
$(PY) ../scripts/make_release.py lsp
30 changes: 15 additions & 15 deletions lib/esbonio/hatch.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,27 @@ include = ["esbonio", "tests", "CHANGES.rst"]
[build.targets.wheel]
packages = ["esbonio"]

[envs.unit]
dependencies = ["pytest", "pytest-cov", "pytest-lsp>=0.3.1,<1"]
[envs.hatch-test]
default-args = ["tests/server"]
extra-dependencies = ["pytest-lsp>=0.3.1,<1"]
matrix-name-format = "{variable}{value}"

[[envs.unit.matrix]]
[[envs.hatch-test.matrix]]
python = ["3.8", "3.9", "3.10", "3.11", "3.12"]

[envs.unit.scripts]
test = "pytest --cov-report=term-missing --cov-config=pyproject.toml --cov=esbonio.server tests/server"
[[envs.hatch-test.matrix]]
python = ["3.8", "3.9", "3.10", "3.11", "3.12"]
sphinx = ["5", "6", "7"]

[envs.e2e]
template = "unit"
extra-dependencies = [
[envs.hatch-test.overrides]
matrix.sphinx.dependencies = [
"furo",
"sphinx-design",
"myst-parser",
"sphinx~={matrix:sphinx}.0",
{ value = "sphinx>=5,<6", if = ["5"] },
{ value = "sphinx>=6,<7", if = ["6"] },
{ value = "sphinx>=7,<8", if = ["7"] },
]

[[envs.e2e.matrix]]
python = ["3.8", "3.9", "3.10", "3.11", "3.12"]
sphinx = ["5", "6", "7"]

[envs.e2e.scripts]
test = "pytest --cov-report=term-missing --cov-config=pyproject.toml --cov=esbonio tests/sphinx-agent tests/e2e"
[envs.hatch-test.overrides.matrix.sphinx.default-args]
value = ["tests/sphinx-agent", "tests/e2e"]
60 changes: 0 additions & 60 deletions lib/esbonio/tox.ini

This file was deleted.

0 comments on commit 5a74041

Please sign in to comment.