Skip to content

Commit ee66dda

Browse files
committed
tests: verify stable releases have stable dependencies
1 parent 5670ae8 commit ee66dda

File tree

3 files changed

+30
-5
lines changed

3 files changed

+30
-5
lines changed

setup.cfg

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,15 @@ include_package_data = true
4141
install_requires =
4242
django-contrib-comments >= 1.9
4343
django >= 2.2
44-
filebrowser-safe >= 0.5
45-
grappelli-safe >= 0.5
4644
tzlocal >= 2
4745
bleach >= 2
4846
beautifulsoup4 >= 4.5.3
4947
requests >= 2.1.0
5048
requests-oauthlib >= 1.3
5149
pillow >= 7
52-
chardet
50+
chardet >= 4
51+
filebrowser_safe@https://github.com/stephenmcd/filebrowser-safe/archive/master.tar.gz
52+
grappelli_safe@https://github.com/stephenmcd/grappelli-safe/archive/master.tar.gz
5353

5454
[options.extras_require]
5555
testing =

tests/test_core.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import re
2+
import subprocess
23
from unittest import skipUnless
34
from urllib.parse import urlencode
45

6+
import pkg_resources
57
import pytest
68
import pytz
79
from django.conf.urls import url
@@ -45,6 +47,31 @@
4547
from mezzanine.utils.tests import TestCase
4648
from mezzanine.utils.urls import admin_url
4749

50+
BRANCH_NAME = (
51+
subprocess.check_output(["git", "rev-parse", "--abbrev-ref", "HEAD"])
52+
.decode()
53+
.strip()
54+
)
55+
VERSION_WARN = (
56+
"Unpinned or pre-release dependencies detected in Mezzanine's requirements: {}"
57+
)
58+
59+
60+
@pytest.mark.skipif(
61+
BRANCH_NAME != "stable", reason="Only runs when publishing stable releases"
62+
)
63+
def test_stable_dependencies():
64+
"""
65+
This test is meant for CI. We want to make sure that when building the `stable`
66+
branch of Mezzanine the dependencies are also stable so that we don't publish a
67+
stable Mezzanine release with unstable dependencies.
68+
"""
69+
# If a requirement is listed via a git or http url the `specs` attribute will be an
70+
# empty list, so we use it to check for "pre-release" status
71+
requirements = pkg_resources.working_set.by_key["mezzanine"].requires()
72+
prereleases = [r.name for r in requirements if not r.specs]
73+
assert not prereleases, VERSION_WARN.format(", ".join(prereleases))
74+
4875

4976
class CoreTests(TestCase):
5077
def test_tagcloser(self):

tox.ini

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ envlist =
99
usedevelop = true
1010
deps =
1111
.[testing]
12-
https://github.com/stephenmcd/filebrowser-safe/archive/master.tar.gz#egg=filebrowser_safe
13-
https://github.com/stephenmcd/grappelli-safe/archive/master.tar.gz#egg=grappelli_safe
1412
dj22: Django>=2.2, <3
1513
dj30: Django>=3.0, <3.1
1614
dj31: Django>=3.1, <3.2

0 commit comments

Comments
 (0)