aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWaylan Limberg <waylan@gmail.com>2013-03-01 13:45:12 -0500
committerWaylan Limberg <waylan@gmail.com>2013-03-01 13:45:12 -0500
commit6bc8b9611c85d321fd4fbad012525b7cd05a66d9 (patch)
tree6f897eec0b37273152ba05fc0c8e5a45342ff6b8
parent26ebafb3b86b224c2acad29bf4d4314a3242189a (diff)
downloadmarkdown-6bc8b9611c85d321fd4fbad012525b7cd05a66d9.tar.gz
markdown-6bc8b9611c85d321fd4fbad012525b7cd05a66d9.tar.bz2
markdown-6bc8b9611c85d321fd4fbad012525b7cd05a66d9.zip
Switched testing to tox.
Also scrapped fabfile.py and replaced it with a much simpler makefile. Tox does most of the stuff that was in fabfile.py anyway. Now that everything runs in all supported python versions without using 2to3, we don't need to wait for tox to support it.
-rw-r--r--.gitignore1
-rw-r--r--fabfile.py105
-rw-r--r--makefile40
-rwxr-xr-xrun-tests.py16
-rw-r--r--tox.ini6
5 files changed, 62 insertions, 106 deletions
diff --git a/.gitignore b/.gitignore
index c57cc74..e810f7a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,3 +10,4 @@ MANIFEST
.venv
*~
*#*
+.tox/*
diff --git a/fabfile.py b/fabfile.py
deleted file mode 100644
index 58f21ba..0000000
--- a/fabfile.py
+++ /dev/null
@@ -1,105 +0,0 @@
-"""
-Common maintenance commands for the Python-Markdown package.
-"""
-
-from fabric.api import local, lcd, settings, hide, prefix, prompt, abort
-from sys import version as _pyversion
-from sys import platform
-
-
-def _get_versions():
- """ Find and comfirm all supported versions of Python. """
- vs = []
- for v in ['2.6', '2.7', '3.1', '3.2', '3.3']:
- with settings(
- hide('warnings', 'running', 'stdout', 'stderr'),
- warn_only=True
- ):
- result = local('hash python%s' % v)
- if not result.failed:
- vs.append(v)
- return vs
-confirmed_versions = _get_versions()
-
-def clean():
- """ Clean up dir. """
- local('git clean -dfx')
-
-def list_versions():
- """ List all supported versions of Python. """
- print('Supported Python versions available on this system:')
- print(' Python ' + '\n Python '.join(confirmed_versions))
-
-def test(version=_pyversion[:3]):
- """ Run tests with given Python Version. Defaults to system default. """
- if version in confirmed_versions:
- build_tests(version=version)
- #with prefix('bash $HOME/.virtualenvs/md%s/bin/activate' % version):
- with lcd('build/test.%s/' % version):
- local('python%s run-tests.py' % version)
- else:
- print('Python %s is not an available supported version.' % version)
- list_versions()
-
-def test_all():
- """ Run tests in all available supported versions. """
- for v in confirmed_versions:
- test(v)
-
-def build_tests(version=_pyversion[:3]):
- """ Build tests for given Python Version. """
- local('python%s setup.py build --build-purelib build/test.%s' % \
- (version, version))
- local('rm -rf build/test.%s/tests' % version)
- local('mkdir build/test.%s/tests' % version)
- local('cp -r tests/* build/test.%s/tests' % version)
- local('cp run-tests.py build/test.%s/run-tests.py' % version)
- local('cp setup.cfg build/test.%s/setup.cfg' % version)
-
-def generate_test(file):
- """ Generate a given test. """
- import sys, os
- sys.path.insert(0, os.path.abspath(os.path.dirname(__file__)))
- import tests
- config = tests.get_config(os.path.dirname(file))
- root, ext = os.path.splitext(file)
- if ext == config.get(tests.get_section(os.path.basename(root), config),
- 'input_ext'):
- tests.generate(root, config)
- else:
- print file, 'does not have a valid file extension. Check config.'
-
-def generate_tests():
- """ Generate all outdated tests. """
- import sys, os
- sys.path.insert(0, os.path.abspath(os.path.dirname(__file__)))
- from tests import generate_all
- generate_all()
-
-def build_env(version=_pyversion[:3]):
- """ Build testing environment for given Python version. """
- if version in confirmed_versions:
- if version == '2.4':
- local('sudo pip%s install ElementTree' % version)
- local('sudo pip%s install nose' % version)
-
-def build_envs():
- """ Build testing env in all supported versions. """
- for v in confirmed_versions:
- build_env(v)
-
-def build_release():
- """ Build a package for distribution. """
- ans = prompt('Have you updated the version_info in __version__.py?', default='Y')
- if ans.lower() == 'y':
- local('./setup.py sdist --formats zip,gztar')
- if platform == 'win32':
- local('./setup.py bdist_wininst')
- else:
- abort('Try again after updating the version numbers.')
-
-def deploy_release():
- """ Register and upload release to PyPI and Github. """
- build_release()
- local('./setup.py register')
- local('./setup.py upload')
diff --git a/makefile b/makefile
new file mode 100644
index 0000000..32ccd27
--- /dev/null
+++ b/makefile
@@ -0,0 +1,40 @@
+# Python-Markdown makefile
+
+install:
+ python setup.py install
+
+deploy: build
+ python setup.py register
+ python setup.py upload
+
+build:
+ python setup.py sdist --formats zip,gztar
+
+build-win:
+ python setup.py bdist_wininst
+
+docs:
+ python setup.py build_docs
+
+test:
+ tox
+
+update-tests:
+ python run-tests.py update
+
+clean:
+ rm -f MANIFEST
+ rm -f test-output.html
+ rm -f *.pyc
+ rm -f markdown/*.pyc
+ rm -f markdown/extensions/*.pyc
+ rm -f *.bak
+ rm -f markdown/*.bak
+ rm -f markdown/extensions/*.bak
+ rm -f *.swp
+ rm -f markdown/*.swp
+ rm -f markdown/extensions/*.swp
+ rm -rf build
+ rm -rf dist
+ rm -rf tmp
+ # git clean -dfx' \ No newline at end of file
diff --git a/run-tests.py b/run-tests.py
index e30c7b3..a2e6d13 100755
--- a/run-tests.py
+++ b/run-tests.py
@@ -1,5 +1,19 @@
#!/usr/bin/env python
import tests
+import os, sys, getopt
-tests.run()
+opts, args = getopt.getopt(sys.argv[1:], '')
+
+if args and args[0] == "update":
+ if len(args) > 1:
+ config = tests.get_config(os.path.dirname(args[1]))
+ root, ext = os.path.splitext(args[1])
+ if ext == config.get(tests.get_section(os.path.basename(root), config), 'input_ext'):
+ tests.generate(root, config)
+ else:
+ print(file, 'does not have a valid file extension. Check config.')
+ else:
+ tests.generate_all()
+else:
+ tests.run()
diff --git a/tox.ini b/tox.ini
new file mode 100644
index 0000000..bab27a0
--- /dev/null
+++ b/tox.ini
@@ -0,0 +1,6 @@
+[tox]
+envlist = py26, py27, py31, py32, py33
+
+[testenv]
+deps=nose
+commands = {envpython} {toxinidir}/run-tests.py {posargs}