Skip to content

Commit

Permalink
Cleanup for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
f-osorio committed Sep 27, 2019
1 parent a03f6b1 commit 1f47328
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 22 deletions.
34 changes: 15 additions & 19 deletions ckan/cli/generate.py
Expand Up @@ -15,10 +15,10 @@ def generate():
@generate.command(name=u'extension', short_help=u"Create empty extension.")
@click.option(u'-n', u'--name', help=u"Name of the extension (must begin "
u"with 'ckanext-')",
default="extension")
default="extension")
@click.option(u'-o', u'--output-dir', help=u"Location to put the generated "
u"template.",
default='.')
default='.')
def extension(name, output_dir):
cur_loc = os.path.dirname(os.path.abspath(__file__))
os.chdir(cur_loc)
Expand All @@ -31,9 +31,9 @@ def extension(name, output_dir):
email = click.prompt("Author's email", default="")
github = click.prompt("Your Github user or organization name", default="")
description = click.prompt("Brief description of the project",
default="")
default="")
keywords = click.prompt("List of keywords (seperated by spaces)",
default="CKAN")
default="CKAN")

# Ensure one instance of 'CKAN' in keywords
keywords = keywords.strip().split()
Expand All @@ -46,22 +46,18 @@ def extension(name, output_dir):
project_shortname = name[8:].lower().replace('-', '_')
plugin_class_name = project_shortname.title().replace('_','') + 'Plugin'

context = {
"project": name,
"description": description,
"author": author,
"author_email": email,
"keywords": keywords,
"github_user_name": github,
"project_shortname": project_shortname,
"plugin_class_name": plugin_class_name,
"_source": "cli"
}
context = {"project": name,
"description": description,
"author": author,
"author_email": email,
"keywords": keywords,
"github_user_name": github,
"project_shortname": project_shortname,
"plugin_class_name": plugin_class_name,
"_source": "cli"}

if output_dir == '.':
os.chdir('../../../..')
output_dir = os.getcwd()
cookiecutter(template_loc,
no_input=True,
extra_context=context,
output_dir=output_dir)
cookiecutter(template_loc, no_input=True, extra_context=context,
output_dir=output_dir)
2 changes: 2 additions & 0 deletions ckan/tests/legacy/test_coding_standards.py
Expand Up @@ -481,6 +481,8 @@ class TestPep8(object):
'setup.py',
'ckan/tests/legacy/models/test_resource.py',
'ckan/tests/legacy/models/test_revision.py',
'ckan/contrib/cookiecutter/ckan_extension/'\
'{{cookiecutter.project}}/setup.py',
]
fails = {}
passes = []
Expand Down
1 change: 1 addition & 0 deletions ckan/tests/test_coding_standards.py
Expand Up @@ -31,6 +31,7 @@
# Directories which are ignored when checking Python source code files
IGNORED_DIRS = [
u'ckan/include',
u'ckan/contrib/cookiecutter'
]


Expand Down
2 changes: 2 additions & 0 deletions contrib/cookiecutter/ckan_extension/hooks/post_gen_project.py
@@ -1,3 +1,5 @@
# encoding: utf-8

import os
import json
import jinja2
Expand Down
2 changes: 2 additions & 0 deletions contrib/cookiecutter/ckan_extension/hooks/pre_gen_project.py
@@ -1,3 +1,5 @@
# encoding: utf-8

import sys


Expand Down
Expand Up @@ -56,14 +56,14 @@
# You can just specify the packages manually here if your project is
# simple. Or you can use find_packages().
packages=find_packages(exclude=['contrib', 'docs', 'tests*']),
namespace_packages=['ckanext'],
namespace_packages=['ckanext'],

install_requires=[
# CKAN extensions should not list dependencies here, but in a separate
# ``requirements.txt`` file.
#
# http://docs.ckan.org/en/latest/extensions/best-practices.html
#add-third-party-libraries-to-requirements-txt
# add-third-party-libraries-to-requirements-txt
],

# If there are data files included in your packages that need to be
Expand All @@ -76,7 +76,7 @@
# Although 'package_data' is the preferred approach, in some case you may
# need to place data files outside of your packages.
# see http://docs.python.org/3.4/distutils/setupscript.html
#installing-additional-files
# installing-additional-files
# In this case, 'data_file' will be installed into '<sys.prefix>/my_data'
data_files=[],

Expand Down

0 comments on commit 1f47328

Please sign in to comment.