mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Cleanup test environment and requirements
- pytest: verbose isn't needed but show skipped tests - mock is not needed anymore. it is part of stdlib - Unpin Sphinx and fix warning about lexer - Mirror tox command for doc build in tasks.py
This commit is contained in:
parent
125dec493e
commit
839629b102
10 changed files with 11 additions and 54 deletions
|
|
@ -2,6 +2,7 @@ import locale
|
|||
import os
|
||||
from shutil import copy, rmtree
|
||||
from tempfile import mkdtemp
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
from pelican.generators import (ArticlesGenerator, Generator, PagesGenerator,
|
||||
PelicanTemplateNotFound, StaticGenerator,
|
||||
|
|
@ -9,14 +10,6 @@ from pelican.generators import (ArticlesGenerator, Generator, PagesGenerator,
|
|||
from pelican.tests.support import get_context, get_settings, unittest
|
||||
from pelican.writers import Writer
|
||||
|
||||
try:
|
||||
from unittest.mock import MagicMock
|
||||
except ImportError:
|
||||
try:
|
||||
from mock import MagicMock
|
||||
except ImportError:
|
||||
MagicMock = False
|
||||
|
||||
|
||||
CUR_DIR = os.path.dirname(__file__)
|
||||
CONTENT_DIR = os.path.join(CUR_DIR, 'content')
|
||||
|
|
@ -198,7 +191,6 @@ class TestArticlesGenerator(unittest.TestCase):
|
|||
return [[article.title, article.status, article.category.name,
|
||||
article.template] for article in articles]
|
||||
|
||||
@unittest.skipUnless(MagicMock, 'Needs Mock module')
|
||||
def test_generate_feeds(self):
|
||||
settings = get_settings()
|
||||
settings['CACHE_PATH'] = self.temp_cache
|
||||
|
|
@ -218,7 +210,6 @@ class TestArticlesGenerator(unittest.TestCase):
|
|||
generator.generate_feeds(writer)
|
||||
self.assertFalse(writer.write_feed.called)
|
||||
|
||||
@unittest.skipUnless(MagicMock, 'Needs Mock module')
|
||||
def test_generate_feeds_override_url(self):
|
||||
settings = get_settings()
|
||||
settings['CACHE_PATH'] = self.temp_cache
|
||||
|
|
@ -334,7 +325,6 @@ class TestArticlesGenerator(unittest.TestCase):
|
|||
categories_expected = ['default', 'yeah', 'test', 'zhi-dao-shu']
|
||||
self.assertEqual(sorted(categories), sorted(categories_expected))
|
||||
|
||||
@unittest.skipUnless(MagicMock, 'Needs Mock module')
|
||||
def test_direct_templates_save_as_url_default(self):
|
||||
|
||||
settings = get_settings()
|
||||
|
|
@ -352,7 +342,6 @@ class TestArticlesGenerator(unittest.TestCase):
|
|||
template_name='archives',
|
||||
page_name='archives', url="archives.html")
|
||||
|
||||
@unittest.skipUnless(MagicMock, 'Needs Mock module')
|
||||
def test_direct_templates_save_as_url_modified(self):
|
||||
|
||||
settings = get_settings()
|
||||
|
|
@ -373,7 +362,6 @@ class TestArticlesGenerator(unittest.TestCase):
|
|||
page_name='archives/index',
|
||||
url="archives/")
|
||||
|
||||
@unittest.skipUnless(MagicMock, 'Needs Mock module')
|
||||
def test_direct_templates_save_as_false(self):
|
||||
|
||||
settings = get_settings()
|
||||
|
|
@ -398,7 +386,6 @@ class TestArticlesGenerator(unittest.TestCase):
|
|||
self.assertIn(custom_template, self.articles)
|
||||
self.assertIn(standard_template, self.articles)
|
||||
|
||||
@unittest.skipUnless(MagicMock, 'Needs Mock module')
|
||||
def test_period_in_timeperiod_archive(self):
|
||||
"""
|
||||
Test that the context of a generated period_archive is passed
|
||||
|
|
@ -1022,7 +1009,6 @@ class TestStaticGenerator(unittest.TestCase):
|
|||
with open(self.endfile) as f:
|
||||
self.assertEqual(f.read(), "staticcontent")
|
||||
|
||||
@unittest.skipUnless(MagicMock, 'Needs Mock module')
|
||||
def test_file_update_required_when_dest_does_not_exist(self):
|
||||
staticfile = MagicMock()
|
||||
staticfile.source_path = self.startfile
|
||||
|
|
@ -1032,7 +1018,6 @@ class TestStaticGenerator(unittest.TestCase):
|
|||
update_required = self.generator._file_update_required(staticfile)
|
||||
self.assertTrue(update_required)
|
||||
|
||||
@unittest.skipUnless(MagicMock, 'Needs Mock module')
|
||||
def test_dest_and_source_mtimes_are_equal(self):
|
||||
staticfile = MagicMock()
|
||||
staticfile.source_path = self.startfile
|
||||
|
|
@ -1045,7 +1030,6 @@ class TestStaticGenerator(unittest.TestCase):
|
|||
isnewer = self.generator._source_is_newer(staticfile)
|
||||
self.assertFalse(isnewer)
|
||||
|
||||
@unittest.skipUnless(MagicMock, 'Needs Mock module')
|
||||
def test_source_is_newer(self):
|
||||
staticfile = MagicMock()
|
||||
staticfile.source_path = self.startfile
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue