Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pytest #170

Merged
merged 2 commits into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .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 All @@ -70,16 +70,16 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
python-version: '3.10'
- uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ '3.9' }}-${{ hashFiles('requirements*.txt') }}
key: ${{ runner.os }}-pip-${{ '3.10' }}-${{ hashFiles('requirements*.txt') }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .
pip install checkmanifest
pip install check-manifest
- name: check-manifest
run: |
check-manifest
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ repos:
rev: '1.0.1'
hooks:
- id: flynt
language_version: python3.8
language_version: python3.10
- repo: https://github.com/psf/black
rev: 22.3.0
hooks:
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
3 changes: 2 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ include LICENSE
include *.rst
include MANIFEST.in
include .coveragerc
include tox.ini
include *.ini
include *.py
include *.sh
include *.txt
include *.yaml

graft docs
graft src
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 = []
5 changes: 2 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@ 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
checkmanifest: check-manifest
django22: Django==2.2.19
django30: Django==3.0.14
django31: Django==3.1.12
Expand Down
Loading