summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZach Smith <subsetpark@gmail.com>2016-08-01 08:53:33 -0400
committerGitHub <noreply@github.com>2016-08-01 08:53:33 -0400
commit9ac94290ef5dc2d1f03fd5001f595ac60938660b (patch)
tree33ad5d120a66c994b9a68ae67d67d2843b871434
parenta9a7fa115af2a32bd45f68a3caee688b4923c242 (diff)
parent7b0104a604867f155bce9b51fe8fca83116cacbf (diff)
downloadpycco-9ac94290ef5dc2d1f03fd5001f595ac60938660b.tar.gz
Merge pull request #97 from medecau/add-tox
Add tox
-rw-r--r--.gitignore2
-rw-r--r--pycco/compat.py1
-rw-r--r--pycco/main.py43
-rw-r--r--pycco_resources/__init__.py4
-rw-r--r--tox.ini11
5 files changed, 38 insertions, 23 deletions
diff --git a/.gitignore b/.gitignore
index e1c9655..96b2167 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,3 +11,5 @@ docs/*
.ropeproject
.DS_Store
+
+.tox \ No newline at end of file
diff --git a/pycco/compat.py b/pycco/compat.py
index 68233a4..856ed6c 100644
--- a/pycco/compat.py
+++ b/pycco/compat.py
@@ -3,6 +3,7 @@ try:
except NameError:
pycco_unichr = chr
+
def compat_items(d):
try:
return d.iteritems()
diff --git a/pycco/main.py b/pycco/main.py
index fe1a8be..55ab0ff 100644
--- a/pycco/main.py
+++ b/pycco/main.py
@@ -4,6 +4,19 @@ from __future__ import print_function
# This module contains all of our static resources.
from pycco_resources import pycco_template, css as pycco_css
+# Import our external dependencies.
+import optparse
+import os
+import pygments
+import re
+import sys
+import time
+import pycco.generate_index as generate_index
+
+from markdown import markdown
+from os import path
+from pygments import lexers, formatters
+
"""
"**Pycco**" is a Python port of [Docco](http://jashkenas.github.com/docco/):
the original quick-and-dirty, hundred-line-long, literate-programming-style
@@ -293,20 +306,8 @@ def generate_html(source, sections, preserve_paths=True, outdir=None):
return re.sub(r"__DOUBLE_OPEN_STACHE__", "{{", rendered).encode("utf-8")
-# === Helpers & Setup ===
-
-# Import our external dependencies.
-import optparse
-import os
-import pygments
-import re
-import sys
-import time
-import pycco.generate_index as generate_index
-from markdown import markdown
-from os import path
-from pygments import lexers, formatters
+# === Helpers & Setup ===
# A list of the languages that Pycco supports, mapping the file extension to
# the name of the Pygments lexer and the symbol that indicates a comment. To
@@ -315,22 +316,22 @@ languages = {
".coffee": {"name": "coffee-script", "symbol": "#",
"multistart": '###', "multiend": '###'},
- ".pl": {"name": "perl", "symbol": "#"},
+ ".pl": {"name": "perl", "symbol": "#"},
".sql": {"name": "sql", "symbol": "--"},
".sh": {"name": "bash", "symbol": "#"},
- ".c": {"name": "c", "symbol": "//",
- "multistart": "/*", "multiend": "*/"},
+ ".c": {"name": "c", "symbol": "//",
+ "multistart": "/*", "multiend": "*/"},
- ".h": {"name": "c", "symbol": "//",
- "multistart": "/*", "multiend": "*/"},
+ ".h": {"name": "c", "symbol": "//",
+ "multistart": "/*", "multiend": "*/"},
".cpp": {"name": "cpp", "symbol": "//"},
- ".cl": {"name": "c", "symbol": "//",
- "multistart": "/*", "multiend": "*/"},
+ ".cl": {"name": "c", "symbol": "//",
+ "multistart": "/*", "multiend": "*/"},
".js": {"name": "javascript", "symbol": "//",
"multistart": "/*", "multiend": "*/"},
@@ -349,7 +350,7 @@ languages = {
".erl": {"name": "erlang", "symbol": "%%"},
- ".tcl": {"name": "tcl", "symbol": "#"},
+ ".tcl": {"name": "tcl", "symbol": "#"},
".hs": {"name": "haskell", "symbol": "--",
"multistart": "{-", "multiend": "-}"},
diff --git a/pycco_resources/__init__.py b/pycco_resources/__init__.py
index a0eb757..08767b7 100644
--- a/pycco_resources/__init__.py
+++ b/pycco_resources/__init__.py
@@ -1,3 +1,5 @@
+import pystache
+
css = """\
/*--------------------- Layout and Typography ----------------------------*/
body {
@@ -236,8 +238,6 @@ html = """\
</body>
"""
-import pystache
-
def template(source):
return lambda context: pystache.render(source, context)
diff --git a/tox.ini b/tox.ini
new file mode 100644
index 0000000..67d9a5d
--- /dev/null
+++ b/tox.ini
@@ -0,0 +1,11 @@
+[tox]
+envlist = py2,py3,codestyle
+
+[testenv]
+deps = -rrequirements.test.txt
+commands = py.test
+
+[testenv:codestyle]
+deps = pycodestyle
+# E501 - line too long
+commands = pycodestyle --ignore=E501