Skip to content

Commit

Permalink
Switched to pytest for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
spookylukey committed Sep 22, 2023
1 parent 779800d commit e8f8ce9
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
pip install -r requirements-test.txt
- name: Test suite
run: |
./runtests.py
pytest
pre-commit:
runs-on: ubuntu-latest
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ To set up your environment to be able to work on django-mailer, do the following

4. Install test requirements::

$ pip install coverage mock
$ pip install -r requirements-test.txt

5. Create a branch for local development::

$ git checkout -b name-of-your-bugfix-or-feature

6. Now you can make your changes locally. Run the tests in the virtualenv using::

$ ./runtests.py
$ pytest

To run the tests in all supported environments, do::

Expand Down
4 changes: 4 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[pytest]
DJANGO_SETTINGS_MODULE = tests.settings
#django_find_project = false
norecursedirs = examples build dist
5 changes: 3 additions & 2 deletions requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
mock==3.0.5;python_version<'3.6'
mock==4.0.1;python_version>='3.6'
pytest
pytest-django
pytest-cov
16 changes: 16 additions & 0 deletions tests/settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
INSTALLED_APPS = [
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sites",
"mailer",
]
DATABASES = {
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": ":memory:",
}
}

SITE_ID = 1
SECRET_KEY = "notasecret"
MIDDLEWARE_CLASSES = []
3 changes: 1 addition & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@ basepython =
py311: python3.11

commands =
test: coverage run ./runtests.py
test: pytest --cov=mailer
checkmanifest: check-manifest
deps =
coverage
-r requirements-test.txt
-e .
checkmanifest: checkmanifest
Expand Down

0 comments on commit e8f8ce9

Please sign in to comment.