Skip to content

Instantly share code, notes, and snippets.

@douglatornell
Created May 19, 2012 03:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save douglatornell/2728853 to your computer and use it in GitHub Desktop.
Save douglatornell/2728853 to your computer and use it in GitHub Desktop.
Typical Traceback of Blogofile plugins Branch Test Error (py.test)
With Python 3.2 py.test as test runner:
___________________________ TestContent.testUpperCaseAutoPermalink ___________________________
self = <blogofile.tests.test_content.TestContent testMethod=testUpperCaseAutoPermalink>
def testUpperCaseAutoPermalink(self):
"""Auto generated permalinks should have title and filenames lower case
(but not the rest of the URL)"""
main.main("init blog_unit_test")
#Write a post to the _posts dir:
src = """---
title: This is a test post
date: 2009/08/16 00:00:00
---
This is a test post without a permalink
"""
f = open(os.path.join(self.build_path,"_posts","01. Test post.html"),"w")
f.write(src)
f.close()
main.config.override_options = {
"site.url":"http://www.BlogoFile.com",
"blog.path":"/Blog",
"blog.auto_permalink.enabled": True,
"blog.auto_permalink.path": "/Blog/:year/:month/:day/:title" }
> main.main("build")
blogofile/tests/test_content.py:95:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cmd = 'build'
def main(cmd=None):
do_debug()
parser = setup_command_parser()
do_completion(cmd)
args = get_args(cmd)
if args.verbose:
logger.setLevel(logging.INFO)
logger.info("Setting verbose mode")
if args.veryverbose:
logger.setLevel(logging.DEBUG)
logger.info("Setting very verbose mode")
#Find the right source directory location:
if args.func == do_init and not args.src_dir:
args.src_dir = os.curdir
elif not args.src_dir:
try:
args.src_dir = find_src_root()
except SourceDirectoryNotFound:
args.src_dir = os.path.abspath(os.curdir)
#Not a valid src dir, the next block warns the user
if not args.src_dir or not os.path.isdir(args.src_dir):
print(("source dir does not exist : %s" % args.src_dir))
sys.exit(1)
os.chdir(args.src_dir)
#The src_dir, which is now the current working directory,
#should already be on the sys.path, but let's make this explicit:
sys.path.insert(0, os.curdir)
> args.func(args)
blogofile/main.py:186:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
args = Namespace(_parser=ArgumentParser(prog='py.test build', usage=None, description=None, version=None, formatter_class=<cl...b738>, src_dir='/private/var/folders/78/78cdS8elGP4pq3lcvj0I+U+++TI/-Tmp-/tmpqaw723', verbose=False, veryverbose=False)
load_config = True
def do_build(args, load_config=True):
if load_config:
config.init_interactive(args)
output_dir = util.path_join("_site", util.fs_site_path_helper())
writer = Writer(output_dir=output_dir)
logger.debug("Running user's pre_build() function...")
config.pre_build()
try:
> writer.write_site()
blogofile/main.py:242:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <blogofile.writer.Writer object at 0x102a01f10>
def write_site(self):
self.__load_bf_cache()
self.__setup_temp_dir()
try:
self.__setup_output_dir()
self.__calculate_template_files()
> self.__init_plugins()
blogofile/writer.py:50:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <blogofile.writer.Writer object at 0x102a01f10>
def __init_plugins(self):
#Run plugin defined init methods
> plugin.init_plugins()
blogofile/writer.py:149:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
def init_plugins():
for name, plugin in list(bf.config.plugins.items()):
if plugin.enabled:
if "mod" not in plugin:
print("Cannot find requested plugin: {0}".format(name))
print("Build aborted.")
> sys.exit(1)
E SystemExit: 1
blogofile/plugin.py:80: SystemExit
-------------------------------------- Captured stdout ---------------------------------------
Initializing the blog_unit_test site template...
Cannot find requested plugin: plugin_test
Build aborted.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment