diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index bc48ce3..eb3b809 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -41,8 +41,7 @@ jobs: python -m pip install --upgrade pip pip install psutil six mock itsdangerous nose testfixtures blinker wheel ./scripts/install_frameworks.sh - python setup.py develop - + pip install --editable . - name: Run Tests run: | export ${{ matrix.env }} diff --git a/.gitignore b/.gitignore index 8ea9535..ef97138 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,8 @@ __pycache__/ # Distribution / packaging .Python env/ +/.venv/ +.envrc build/ develop-eggs/ dist/ @@ -51,6 +53,7 @@ coverage.xml # Django stuff: *.log +/examples/django_app/db.sqlite3 # Sphinx documentation docs/_build/ diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..a700646 --- /dev/null +++ b/Makefile @@ -0,0 +1,39 @@ +SHELL:= /usr/bin/env bash +.EXPORT_ALL_VARIABLES: +PIP_REQUIRE_VIRTUALENV ?= true + +PY:= python3.9 + +.PHONY: test develop django clean + +test: develop + source .venv/bin/activate && \ + python setup.py test + +develop: .venv/bin/wheel + source .venv/bin/activate && \ + pip install --editable . + +django: develop +ifndef HONEYBADGER_API_KEY + $(error HONEYBADGER_API_KEY is undefined) +endif + source .venv/bin/activate && \ + cd examples/django_app && \ + pip install --requirement requirements.txt && \ + python manage.py migrate && \ + echo "Go to http://127.0.0.1/api/div to generate an alert." && \ + python manage.py runserver + +.venv/bin/wheel: .venv/ + source .venv/bin/activate && \ + pip install --upgrade pip setuptools wheel + +.venv/: + $(PY) -m venv .venv + +clean: + rm --force --recursive honeybadger.egg-info/ + rm --force --recursive .venv/ .eggs/ + find -type d -name __pycache__ -print0 |xargs -r0 rm --force --recursive + rm --force examples/django_app/db.sqlite3 diff --git a/README.md b/README.md index 86a55a9..aafb527 100644 --- a/README.md +++ b/README.md @@ -439,13 +439,13 @@ honeybadger.notify(error_class='ValueError', error_message='Something bad happen After cloning the repo, run: ```sh -python setup.py develop +make develop ``` To run the unit tests: ```sh -python setup.py test +make test ``` ## Contributing diff --git a/run_tests.sh b/run_tests.sh index 1a864c9..434376f 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -7,5 +7,5 @@ pip --version pip install psutil six [ ! -z "$DJANGO_VERSION" ] && pip install Django==$DJANGO_VERSION [ ! -z "$FLASK_VERSION" ] && pip install Flask==$FLASK_VERSION -python setup.py develop +pip install --editable . python setup.py test \ No newline at end of file