Skip to content

Commit

Permalink
Merge 0c4d86e into 6795ae5
Browse files Browse the repository at this point in the history
  • Loading branch information
yakky committed Dec 6, 2020
2 parents 6795ae5 + 0c4d86e commit 920f8a7
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 17 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/test.yml
Expand Up @@ -8,14 +8,10 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8, 3.7, 3.6, 3.5]
python-version: [3.9, 3.8, 3.7, 3.6]
django: [31, 30, 22]
cms: [38, 37]
exclude:
- python-version: 3.5
django: 30
- python-version: 3.5
django: 31
- django: 31
cms: 37
include:
Expand Down
1 change: 1 addition & 0 deletions changes/657.feature
@@ -0,0 +1 @@
Add support for Python 3.9
2 changes: 1 addition & 1 deletion setup.cfg
Expand Up @@ -43,10 +43,10 @@ classifiers =
Framework :: Django :: 3.1
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3.5
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9

[options]
include_package_data = True
Expand Down
5 changes: 3 additions & 2 deletions tests/base.py
Expand Up @@ -6,8 +6,6 @@
from django.contrib.auth import get_user_model
from django.contrib.sites.models import Site
from django.core.cache import cache
from haystack import connections
from haystack.constants import DEFAULT_ALIAS
from menus.menu_pool import menu_pool
from parler.utils.context import smart_override

Expand Down Expand Up @@ -257,6 +255,9 @@ def get_posts(self, sites=None):
return posts

def get_post_index(self):
from haystack import connections
from haystack.constants import DEFAULT_ALIAS

search_conn = connections[DEFAULT_ALIAS]
unified_index = search_conn.get_unified_index()
index = unified_index.get_index(Post)
Expand Down
12 changes: 10 additions & 2 deletions tests/test_indexing.py
Expand Up @@ -2,8 +2,6 @@

from cms.api import add_plugin
from django.test import override_settings
from haystack.constants import DEFAULT_ALIAS
from haystack.query import SearchQuerySet

from djangocms_blog.models import Post

Expand All @@ -14,6 +12,13 @@
except ImportError:
aldryn_search = None

try:
import haystack
from haystack.constants import DEFAULT_ALIAS
from haystack.query import SearchQuerySet
except ImportError:
haystack = None


class BlogIndexingTests(BaseTest):
sample_text = "First post first line This is the description keyword1 keyword2 category 1 a tag test body"
Expand All @@ -22,6 +27,7 @@ def setUp(self):
self.get_pages()

@skipIf(aldryn_search is None, "aldryn-search not installed")
@skipIf(haystack is None, "haystack not installed")
def test_blog_post_is_indexed_using_prepare(self):
"""This tests the indexing path way used by update_index mgmt command"""
post = self._get_post(self._post_data[0]["en"])
Expand All @@ -41,6 +47,7 @@ def test_blog_post_is_indexed_using_prepare(self):
self.assertEqual(post.date_published, indexed["pub_date"])

@skipIf(aldryn_search is None, "aldryn-search not installed")
@skipIf(haystack is None, "haystack not installed")
@override_settings(BLOG_USE_PLACEHOLDER=False)
def test_blog_post_is_indexed_using_prepare_no_placeholder(self):
"""This tests the indexing path way used by update_index mgmt command when not using placeholder content"""
Expand All @@ -62,6 +69,7 @@ def test_blog_post_is_indexed_using_prepare_no_placeholder(self):
self.assertEqual(post.get_absolute_url(), indexed["url"])
self.assertEqual(post.date_published, indexed["pub_date"])

@skipIf(haystack is None, "haystack not installed")
def test_searchqueryset(self):
posts = self.get_posts()
all_results = SearchQuerySet().models(Post)
Expand Down
5 changes: 4 additions & 1 deletion tests/test_models.py
Expand Up @@ -1061,7 +1061,10 @@ def test_urls(self):
post.app_config = self.app_config_1

self.assertTrue(
re.match(r".*{}/{}/$".format(urlquote(post.categories.first().slug), urlquote(post.slug)), post.get_absolute_url())
re.match(
r".*{}/{}/$".format(urlquote(post.categories.first().slug), urlquote(post.slug)),
post.get_absolute_url(),
)
)

# slug only
Expand Down
11 changes: 5 additions & 6 deletions tox.ini
Expand Up @@ -8,9 +8,9 @@ envlist =
pep8
pypi-description
towncrier
py{38,37,36}-django{31}-cms{38,no-search-38}
py{38,37,36}-django{30}-cms{38,37,no-search-37}
py{38,37,36,35}-django{22}-cms{38,37,no-search-37}
py{39,38,37,36}-django{31}-cms{38,no-search-38}
py{39,38,37,36}-django{30}-cms{38,37,no-search-37}
py{39,38,37,36,35}-django{22}-cms{38,37,no-search-37}

[testenv]
commands = {env:COMMAND:python} cms_helper.py djangocms_blog test {posargs}
Expand All @@ -19,22 +19,21 @@ deps =
django22: django-mptt>=0.8
django22: django-filer>=1.5,<1.6
django22: django-appdata>=0.2.2
django22: django-haystack
django30: Django>=3.0,<3.1
django30: django-mptt>=0.9
django30: django-filer>=1.6
django30: django-appdata>=0.3.0
django30: django-haystack==3.0b2
django31: Django>=3.1,<3.2
django31: django-mptt>=0.9
django31: django-filer>=2.0
django31: django-appdata>=0.3.2
django31: django-haystack==3.0b2
cms37: https://github.com/divio/django-cms/archive/release/3.7.x.zip
cms37: aldryn-search
cms37: django-haystack==3.0b2
cms-no-search-37: https://github.com/divio/django-cms/archive/release/3.7.x.zip
cms38: https://github.com/divio/django-cms/archive/release/3.8.x.zip
cms38: aldryn-search
cms38: django-haystack==3.0b2
cms-no-search-38: https://github.com/divio/django-cms/archive/release/3.8.x.zip
channels>2,<3
https://github.com/nephila/django-knocker/archive/master.zip
Expand Down

0 comments on commit 920f8a7

Please sign in to comment.