Merge pull request #2721 from avaris/fix-test-plugins

Test updates
This commit is contained in:
Justin Mayer 2020-04-14 23:00:23 +02:00 committed by GitHub
commit cefe984c7e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 287 additions and 17 deletions

View file

@ -0,0 +1,66 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="generator" content="Pelican" />
<title>A draft article without date</title>
<link rel="stylesheet" href="/theme/css/main.css" />
<link href="/feeds/all.atom.xml" type="application/atom+xml" rel="alternate" title="A Pelican Blog Atom Feed" />
</head>
<body id="index" class="home">
<header id="banner" class="body">
<h1><a href="/">A Pelican Blog</a></h1>
<nav><ul>
<li><a href="/tag/oh.html">Oh Oh Oh</a></li>
<li><a href="/override/">Override url/save_as</a></li>
<li><a href="/pages/this-is-a-test-page.html">This is a test page</a></li>
<li><a href="/category/bar.html">bar</a></li>
<li><a href="/category/cat1.html">cat1</a></li>
<li class="active"><a href="/category/misc.html">misc</a></li>
<li><a href="/category/yeah.html">yeah</a></li>
</ul></nav>
</header><!-- /#banner -->
<section id="content" class="body">
<article>
<header>
<h1 class="entry-title">
<a href="/drafts/a-draft-article-without-date.html" rel="bookmark"
title="Permalink to A draft article without date">A draft article without date</a></h1>
</header>
<div class="entry-content">
<footer class="post-info">
<abbr class="published" title="9999-12-31T23:59:59.999999+00:00">
Published:
</abbr>
<p>In <a href="/category/misc.html">misc</a>.</p>
</footer><!-- /.post-info --> <p>This is a draft article, it should live under the /drafts/ folder and not be
listed anywhere else.</p>
</div><!-- /.entry-content -->
</article>
</section>
<section id="extras" class="body">
<div class="social">
<h2>social</h2>
<ul>
<li><a href="/feeds/all.atom.xml" type="application/atom+xml" rel="alternate">atom feed</a></li>
</ul>
</div><!-- /.social -->
</section><!-- /#extras -->
<footer id="contentinfo" class="body">
<address id="about" class="vcard body">
Proudly powered by <a href="https://getpelican.com/">Pelican</a>, which takes great advantage of <a href="https://www.python.org/">Python</a>.
</address><!-- /#about -->
<p>The theme is by <a href="https://www.smashingmagazine.com/2009/08/designing-a-html-5-layout-from-scratch/">Smashing Magazine</a>, thanks!</p>
</footer><!-- /#contentinfo -->
</body>
</html>

View file

@ -0,0 +1,97 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="generator" content="Pelican" />
<title>A draft article without date</title>
<link rel="stylesheet" href="../theme/css/main.css" />
<link href="http://blog.notmyidea.org/feeds/all.atom.xml" type="application/atom+xml" rel="alternate" title="Alexis' log Atom Feed" />
<link href="http://blog.notmyidea.org/feeds/all.rss.xml" type="application/rss+xml" rel="alternate" title="Alexis' log RSS Feed" />
</head>
<body id="index" class="home">
<a href="http://github.com/ametaireau/">
<img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png" alt="Fork me on GitHub" />
</a>
<header id="banner" class="body">
<h1><a href="../">Alexis' log <strong>A personal blog.</strong></a></h1>
<nav><ul>
<li><a href="../tag/oh.html">Oh Oh Oh</a></li>
<li><a href="../override/">Override url/save_as</a></li>
<li><a href="../pages/this-is-a-test-page.html">This is a test page</a></li>
<li><a href="../category/yeah.html">yeah</a></li>
<li class="active"><a href="../category/misc.html">misc</a></li>
<li><a href="../category/cat1.html">cat1</a></li>
<li><a href="../category/bar.html">bar</a></li>
</ul></nav>
</header><!-- /#banner -->
<section id="content" class="body">
<article>
<header>
<h1 class="entry-title">
<a href="../drafts/a-draft-article-without-date.html" rel="bookmark"
title="Permalink to A draft article without date">A draft article without date</a></h1>
</header>
<div class="entry-content">
<footer class="post-info">
<abbr class="published" title="2012-03-02T14:01:01+01:00">
Published: Fri 02 March 2012
</abbr>
<address class="vcard author">
By <a class="url fn" href="../author/alexis-metaireau.html">Alexis Métaireau</a>
</address>
<p>In <a href="../category/misc.html">misc</a>.</p>
</footer><!-- /.post-info --> <p>This is a draft article, it should live under the /drafts/ folder and not be
listed anywhere else.</p>
</div><!-- /.entry-content -->
</article>
</section>
<section id="extras" class="body">
<div class="blogroll">
<h2>links</h2>
<ul>
<li><a href="http://biologeek.org">Biologeek</a></li>
<li><a href="http://filyb.info/">Filyb</a></li>
<li><a href="http://www.libert-fr.com">Libert-fr</a></li>
<li><a href="http://prendreuncafe.com/blog/">N1k0</a></li>
<li><a href="http://ziade.org/blog">Tarek Ziadé</a></li>
<li><a href="http://zubin71.wordpress.com/">Zubin Mithra</a></li>
</ul>
</div><!-- /.blogroll -->
<div class="social">
<h2>social</h2>
<ul>
<li><a href="http://blog.notmyidea.org/feeds/all.atom.xml" type="application/atom+xml" rel="alternate">atom feed</a></li>
<li><a href="http://blog.notmyidea.org/feeds/all.rss.xml" type="application/rss+xml" rel="alternate">rss feed</a></li>
<li><a href="http://twitter.com/ametaireau">twitter</a></li>
<li><a href="http://lastfm.com/user/akounet">lastfm</a></li>
<li><a href="http://github.com/ametaireau">github</a></li>
</ul>
</div><!-- /.social -->
</section><!-- /#extras -->
<footer id="contentinfo" class="body">
<address id="about" class="vcard body">
Proudly powered by <a href="https://getpelican.com/">Pelican</a>, which takes great advantage of <a href="https://www.python.org/">Python</a>.
</address><!-- /#about -->
<p>The theme is by <a href="https://www.smashingmagazine.com/2009/08/designing-a-html-5-layout-from-scratch/">Smashing Magazine</a>, thanks!</p>
</footer><!-- /#contentinfo -->
<script type="text/javascript">
var disqus_shortname = 'blog-notmyidea';
(function () {
var s = document.createElement('script'); s.async = true;
s.type = 'text/javascript';
s.src = 'https://' + disqus_shortname + '.disqus.com/count.js';
(document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
}());
</script>
</body>
</html>

View file

@ -0,0 +1,97 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="generator" content="Pelican" />
<title>A draft article without date</title>
<link rel="stylesheet" href="../theme/css/main.css" />
<link href="http://blog.notmyidea.org/feeds/all.atom.xml" type="application/atom+xml" rel="alternate" title="Alexis' log Atom Feed" />
<link href="http://blog.notmyidea.org/feeds/all.rss.xml" type="application/rss+xml" rel="alternate" title="Alexis' log RSS Feed" />
</head>
<body id="index" class="home">
<a href="http://github.com/ametaireau/">
<img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png" alt="Fork me on GitHub" />
</a>
<header id="banner" class="body">
<h1><a href="../">Alexis' log</a></h1>
<nav><ul>
<li><a href="../tag/oh.html">Oh Oh Oh</a></li>
<li><a href="../override/">Override url/save_as</a></li>
<li><a href="../pages/this-is-a-test-page.html">This is a test page</a></li>
<li><a href="../category/yeah.html">yeah</a></li>
<li class="active"><a href="../category/misc.html">misc</a></li>
<li><a href="../category/cat1.html">cat1</a></li>
<li><a href="../category/bar.html">bar</a></li>
</ul></nav>
</header><!-- /#banner -->
<section id="content" class="body">
<article>
<header>
<h1 class="entry-title">
<a href="../drafts/a-draft-article-without-date.html" rel="bookmark"
title="Permalink to A draft article without date">A draft article without date</a></h1>
</header>
<div class="entry-content">
<footer class="post-info">
<abbr class="published" title="2012-03-02T14:01:01+01:00">
Published: 02 mars 2012
</abbr>
<address class="vcard author">
By <a class="url fn" href="../author/alexis-metaireau.html">Alexis Métaireau</a>
</address>
<p>In <a href="../category/misc.html">misc</a>.</p>
</footer><!-- /.post-info --> <p>This is a draft article, it should live under the /drafts/ folder and not be
listed anywhere else.</p>
</div><!-- /.entry-content -->
</article>
</section>
<section id="extras" class="body">
<div class="blogroll">
<h2>links</h2>
<ul>
<li><a href="http://biologeek.org">Biologeek</a></li>
<li><a href="http://filyb.info/">Filyb</a></li>
<li><a href="http://www.libert-fr.com">Libert-fr</a></li>
<li><a href="http://prendreuncafe.com/blog/">N1k0</a></li>
<li><a href="http://ziade.org/blog">Tarek Ziadé</a></li>
<li><a href="http://zubin71.wordpress.com/">Zubin Mithra</a></li>
</ul>
</div><!-- /.blogroll -->
<div class="social">
<h2>social</h2>
<ul>
<li><a href="http://blog.notmyidea.org/feeds/all.atom.xml" type="application/atom+xml" rel="alternate">atom feed</a></li>
<li><a href="http://blog.notmyidea.org/feeds/all.rss.xml" type="application/rss+xml" rel="alternate">rss feed</a></li>
<li><a href="http://twitter.com/ametaireau">twitter</a></li>
<li><a href="http://lastfm.com/user/akounet">lastfm</a></li>
<li><a href="http://github.com/ametaireau">github</a></li>
</ul>
</div><!-- /.social -->
</section><!-- /#extras -->
<footer id="contentinfo" class="body">
<address id="about" class="vcard body">
Proudly powered by <a href="https://getpelican.com/">Pelican</a>, which takes great advantage of <a href="https://www.python.org/">Python</a>.
</address><!-- /#about -->
<p>The theme is by <a href="https://www.smashingmagazine.com/2009/08/designing-a-html-5-layout-from-scratch/">Smashing Magazine</a>, thanks!</p>
</footer><!-- /#contentinfo -->
<script type="text/javascript">
var disqus_shortname = 'blog-notmyidea';
(function () {
var s = document.createElement('script'); s.async = true;
s.type = 'text/javascript';
s.src = 'https://' + disqus_shortname + '.disqus.com/count.js';
(document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
}());
</script>
</body>
</html>

View file

@ -66,35 +66,38 @@ class PluginTest(unittest.TestCase):
self.assertEqual(pelican.__path__, old_path)
def test_get_namespace_plugins(self):
# without plugins
ns_plugins = get_namespace_plugins()
self.assertEqual(len(ns_plugins), 0)
# existing namespace plugins
existing_ns_plugins = get_namespace_plugins()
# with plugin
with tmp_namespace_path(self._NS_PLUGIN_FOLDER):
ns_plugins = get_namespace_plugins()
self.assertEqual(len(ns_plugins), 1)
self.assertEqual(len(ns_plugins), len(existing_ns_plugins)+1)
self.assertIn('pelican.plugins.ns_plugin', ns_plugins)
self.assertEqual(
ns_plugins['pelican.plugins.ns_plugin'].NAME,
'namespace plugin')
# should be back to 0 outside `with`
# should be back to existing namespace plugins outside `with`
ns_plugins = get_namespace_plugins()
self.assertEqual(len(ns_plugins), 0)
self.assertEqual(ns_plugins, existing_ns_plugins)
def test_load_plugins(self):
# no plugins
plugins = load_plugins({})
self.assertEqual(len(plugins), 0)
def get_plugin_names(plugins):
return set(
plugin.NAME if hasattr(plugin, 'NAME') else plugin.__name__
for plugin in plugins)
# existing namespace plugins
existing_ns_plugins = load_plugins({})
with tmp_namespace_path(self._NS_PLUGIN_FOLDER):
# with no `PLUGINS` setting, load namespace plugins
plugins = load_plugins({})
self.assertEqual(len(plugins), 1, plugins)
self.assertEqual(len(plugins), len(existing_ns_plugins)+1, plugins)
self.assertEqual(
{'namespace plugin'},
set(plugin.NAME for plugin in plugins))
{'namespace plugin'} | get_plugin_names(existing_ns_plugins),
get_plugin_names(plugins))
# disable namespace plugins with `PLUGINS = []`
SETTINGS = {
@ -103,7 +106,7 @@ class PluginTest(unittest.TestCase):
plugins = load_plugins(SETTINGS)
self.assertEqual(len(plugins), 0, plugins)
# using `PLUGINS`
# with `PLUGINS`, load only specified plugins
# normal plugin
SETTINGS = {
@ -114,7 +117,7 @@ class PluginTest(unittest.TestCase):
self.assertEqual(len(plugins), 1, plugins)
self.assertEqual(
{'normal plugin'},
set(plugin.NAME for plugin in plugins))
get_plugin_names(plugins))
# namespace plugin short
SETTINGS = {
@ -124,7 +127,7 @@ class PluginTest(unittest.TestCase):
self.assertEqual(len(plugins), 1, plugins)
self.assertEqual(
{'namespace plugin'},
set(plugin.NAME for plugin in plugins))
get_plugin_names(plugins))
# namespace plugin long
SETTINGS = {
@ -134,7 +137,7 @@ class PluginTest(unittest.TestCase):
self.assertEqual(len(plugins), 1, plugins)
self.assertEqual(
{'namespace plugin'},
set(plugin.NAME for plugin in plugins))
get_plugin_names(plugins))
# normal and namespace plugin
SETTINGS = {
@ -145,4 +148,4 @@ class PluginTest(unittest.TestCase):
self.assertEqual(len(plugins), 2, plugins)
self.assertEqual(
{'normal plugin', 'namespace plugin'},
set(plugin.NAME for plugin in plugins))
get_plugin_names(plugins))

View file

@ -0,0 +1,7 @@
A draft article without date
############################
:status: draft
This is a draft article, it should live under the /drafts/ folder and not be
listed anywhere else.