From ce7389846bf01db9d6f4869ee34a4502cb3449bf Mon Sep 17 00:00:00 2001 From: Plutonium-239 Date: Sun, 31 Mar 2024 14:38:38 +0530 Subject: [PATCH] github action for pytest, makefile additions --- .github/workflows/pytest.yml | 11 +++++++++++ .github/workflows/ruff.yml | 3 ++- makefile | 16 ++++++++++++++++ pyproject.toml | 8 ++++++++ 4 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/pytest.yml diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml new file mode 100644 index 0000000..ed59e20 --- /dev/null +++ b/.github/workflows/pytest.yml @@ -0,0 +1,11 @@ +name: Pytest +on: [push, pull_request] +jobs: + pytest: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: pytest-install + run: make install-test + - name: pytest + run: make test \ No newline at end of file diff --git a/.github/workflows/ruff.yml b/.github/workflows/ruff.yml index 86613f8..a1cce89 100644 --- a/.github/workflows/ruff.yml +++ b/.github/workflows/ruff.yml @@ -5,10 +5,11 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + - name: ruff-install + run: pip install ruff - name: ruff env: RUFF_OUTPUT_FORMAT: github run: | - pip install ruff ruff format --check ruff check diff --git a/makefile b/makefile index b99005d..b14bbf0 100644 --- a/makefile +++ b/makefile @@ -1,10 +1,26 @@ .DEFAULT: help help: + @echo "install" + @echo " Install as an editable package" + @echo "install-test" + @echo " Install as an editable package + test" @echo "ruff" @echo " Run ruff formatter and linter" @echo "test" @echo " Run pytest (tests directory)" + @echo "test-full" + @echo " Run pytest with expensive tests (tests directory)" + +.PHONY: install + +install: + @pip install -e . + +.PHONY: install-test + +install-test: + @pip install -e .[test] .PHONY: ruff diff --git a/pyproject.toml b/pyproject.toml index bf96bc6..af9d42f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -25,6 +25,14 @@ classifiers = [ [project.urls] Repository = "https://github.com/plutonium-239/memsave_torch" +[project.optional-dependencies] +test = [ + 'coveralls', + 'pytest', + 'pytest-cov', + 'pytest-optional-tests', +] + [tool.pytest.ini_options] markers = [ "quick: marks tests as quick (only run on make test or using pytest -m quick)",