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

update testing matrix #80

Merged
merged 3 commits into from
Jun 7, 2024
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
5 changes: 3 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@ jobs:
strategy:
matrix:
python-version:
# - "3.6" stopped working with GitHub actions, disabling temporarily
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
fail-fast: false

services:
Expand Down Expand Up @@ -58,7 +59,7 @@ jobs:

- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel setuptools tox
python -m pip install --upgrade pip wheel tox
- name: Run tox targets for ${{ matrix.python-version }}
run: |
ENV_PREFIX=$(tr -C -d "0-9" <<< "${{ matrix.python-version }}")
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,7 @@ You may need to do this if you use a custom user model and upgrade Django.

* added tolerance to the ending slash in URL
* ReferralResponse now stores http_referrer
* Updated testing. Tests now passes in Django 2.2-5.1 and Python 3.7-3.12

### 4.2.0 (2023-01-12)

Expand Down
12 changes: 6 additions & 6 deletions pinax/referrals/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ def test_referral_responses_for_request_no_user(self):
# Create a referral with a blank user
request = RequestFactory().get("/referral/")
request.session = self.client.session
baker.make("ReferralResponse", session_key=request.session.session_key)
baker.make("ReferralResponse", user=baker.make("User"))
baker.make("ReferralResponse", session_key=request.session.session_key, target=None, referral__target=None)
baker.make("ReferralResponse", user=baker.make("User"), target=None, referral__target=None)
queryset = Referral.referral_responses_for_request(request)
self.assertEqual(queryset.count(), 1)
self.assertEqual(queryset.get().session_key, request.session.session_key)
Expand All @@ -31,8 +31,8 @@ def test_referral_responses_for_request_user(self):
request = RequestFactory().get("/referral/")
request.session = self.client.session
request.user = baker.make("User")
baker.make("ReferralResponse", user=request.user, session_key="foo_bar")
baker.make("ReferralResponse", session_key="session_key")
baker.make("ReferralResponse", user=request.user, session_key="foo_bar", target=None, referral__target=None)
baker.make("ReferralResponse", session_key="session_key", target=None, referral__target=None)
queryset = Referral.referral_responses_for_request(request)
self.assertEqual(queryset.count(), 1)
self.assertEqual(queryset.get().user, request.user)
Expand All @@ -41,14 +41,14 @@ def test_referral_responses_for_request_user(self):
@override_settings(PINAX_REFERRALS_CODE_GENERATOR_CALLBACK=generate_code_callback)
def test_code_generator_callback(self):
user = baker.make("User", username="joe")
referral = baker.make("Referral", user=user, code=None)
referral = baker.make("Referral", user=user, code=None, target=None)
# the callback function is being called in the save() method, inside baker.make
self.assertEqual(referral.code, "recommended-by-joe")

@override_settings(PINAX_REFERRALS_CODE_GENERATOR_CALLBACK=legacy_generate_code_callback)
def test_legacy_code_generator_callback(self):
# the new callback signature accepts two parameters, but the old callback signature
# with just the referral_class as parameter should still work
referral = baker.make("Referral", code=None)
referral = baker.make("Referral", code=None, target=None)
# the callback function is being called in the save() method, inside baker.make
self.assertEqual(referral.code, "some-generated-code")
12 changes: 10 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,27 @@ show_missing = True
[tox]
envlist =
checkqa,
py{36,37,38,39}-dj{22,30,31},
py{38,39,310}-dj{32,40,41,main}
py{37,38,39}-dj{22,30,31},
py{37,38,39,310}-dj{32}
py{38,39,310}-dj{32,40}
py{38,39,310,311}-dj{41}
py{38,39,310,311,312}-dj{42}
py{310,311,312}-dj{50,51,main}

[testenv]
passenv = CI, CIRCLECI, CIRCLE_*
deps =
coverage<5
setuptools
dj22: Django>=2.2,<3.0
dj30: Django>=3.0,<3.1
dj31: Django>=3.1,<3.2
dj32: Django>=3.2,<4.0
dj40: Django>=4.0,<4.1
dj41: Django>=4.1,<4.2
dj42: Django>=4.2,<5.0
dj50: Django>=5.0,<5.1
dj51: Django>=5.1a1,<5.2
master: https://github.com/django/django/tarball/master
-r requirements_test.txt

Expand Down
Loading