diff --git a/.gitignore b/.gitignore index 8b84e15..43eb464 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ .tox/ build/ +# py.test related +.cache/ diff --git a/build-requirements.pip b/build-requirements.pip new file mode 100644 index 0000000..5db8fbe --- /dev/null +++ b/build-requirements.pip @@ -0,0 +1,4 @@ +py-gfm +PyYAML +shell +cached-property diff --git a/build.py b/build.py index 7b15cc7..286d840 100644 --- a/build.py +++ b/build.py @@ -16,6 +16,7 @@ import yaml + SOURCE_FILE_TEXT = '

Link to {source_file_basename}

' # noqa HTACCESS = """ # Serving .md files as UTF-8. @@ -24,9 +25,10 @@ DEFAULT_PAGE = {} + class Builder(object): - exceptions = ('.tox', '.git', 'build', 'static', 'templates') + exceptions = ('.tox', '.git', 'build', 'static', 'templates', 'tests',) def __init__(self): self.build_path = abspath('build') diff --git a/test-requirements.pip b/test-requirements.pip new file mode 100644 index 0000000..e079f8a --- /dev/null +++ b/test-requirements.pip @@ -0,0 +1 @@ +pytest diff --git a/tests/test_slugify.py b/tests/test_slugify.py new file mode 100644 index 0000000..81b8b58 --- /dev/null +++ b/tests/test_slugify.py @@ -0,0 +1 @@ +from ..toolbox import slugify diff --git a/toolbox/__init__.py b/toolbox/__init__.py new file mode 100644 index 0000000..1fbac4e --- /dev/null +++ b/toolbox/__init__.py @@ -0,0 +1 @@ +from markdown.extensions.headerid import slugify diff --git a/toolbox/tests/__init__.py b/toolbox/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/toolbox/tests/test_slugify.py b/toolbox/tests/test_slugify.py new file mode 100644 index 0000000..ade2567 --- /dev/null +++ b/toolbox/tests/test_slugify.py @@ -0,0 +1,20 @@ +from .. import slugify + + +def test_slugify_english(): + assert slugify('hello', '-') == 'hello' + assert slugify('hello world', '-') == 'hello-world' + + +def test_slugify_french(): + assert slugify("De quoi s'agit-il ?", '-') == 'de-quoi-sagit-il' + + +def test_slugify_castellano(): + assert slugify("¿Qué es esto?", '-') == 'que-es-esto' + + +def test_slugify_converting_saves(): + assert slugify('Converting Saves', '-') == 'converting-saves' + assert slugify('Conversion des jets de sauvegarde', '-') == 'conversion-des-jets-de-sauvegarde' # noqa + assert slugify('Convirtiendo tiradas de salvación', '-') == 'convirtiendo-tiradas-de-salvacion' # noqa diff --git a/tox.ini b/tox.ini index c9fe498..c5a3cc6 100644 --- a/tox.ini +++ b/tox.ini @@ -1,15 +1,21 @@ [tox] -envlist = build +envlist = build,test skipsdist = True [testenv] basepython = python3.4 deps = - py-gfm - PyYAML - shell - cached-property + -rbuild-requirements.pip # For debuggin purposes - ipdb + # ipdb commands = python build.py + + +[testenv:test] +basepython = python3.4 +deps = + -rbuild-requirements.pip + -rtest-requirements.pip +commands = + py.test toolbox