support to bootfile and new release

This commit is contained in:
Gabriel Falcao 2013-10-25 15:24:39 -04:00
parent b766034628
commit 7dfcf36430
5 changed files with 37 additions and 11 deletions

View File

@ -1,5 +1,5 @@
# Steady Mark
> version 0.4.5
> version 0.5.0
[![Build Status](https://secure.travis-ci.org/gabrielfalcao/steadymark.png?branch=master)](http://travis-ci.org/#!/gabrielfalcao/steadymark)
![meme](http://cdn.memegenerator.net/instances/400x/24908847.jpg)
@ -64,10 +64,15 @@ Just run with:
$ steadymark README.md
```
# Steadymark is on version 0.4.5
## loading a python file before running tests
you can tell steadymark to load a "boot" file before running the tests, it's very useful for hooking up [sure](http://falcao.it/sure) or [HTTPretty](http://falcao.it/HTTPretty)
# Steadymark is on version 0.5.0
```python
>>> from sure import expect
>>> from steadymark import version
>>> assert expect(version).should.equal("0.4.5")
>>> assert expect(version).should.equal("0.5.0")
```

View File

@ -24,7 +24,7 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
from __future__ import unicode_literals
import imp
from optparse import OptionParser
from steadymark.six import text_type
from steadymark.version import version
@ -32,7 +32,10 @@ try:
from steadymark.runner import Runner
except ImportError as e:
if 'misaka' in text_type(e):
Runner = None
import ipdb;ipdb.set_trace()
print "Please install misaka in order to use steadymark"
raise SystemExit(1)
else:
raise
@ -45,7 +48,14 @@ def run(filenames):
def main():
parser = OptionParser()
parser.add_option("-b", "--bootstrap", dest="bootstrap_file",
help="A path to a python file to be loaded before steadymark runs the tests")
(options, args) = parser.parse_args()
if options.bootstrap_file:
imp.load_source('steadymark_bootstrap', options.bootstrap_file)
run(args or ['README.md'])
__all__ = [

View File

@ -25,4 +25,4 @@
# OTHER DEALINGS IN THE SOFTWARE.
from __future__ import unicode_literals
version = '0.4.5'
version = '0.5.0'

View File

@ -0,0 +1,3 @@
print "AWESOME SAUCE"
import sys
sys.exit(42)

View File

@ -23,7 +23,7 @@
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
import os
import sys
from os.path import dirname, abspath, join
from subprocess import check_call, CalledProcessError
@ -35,10 +35,10 @@ MAINDIR = abspath(join(CURDIR, '..', '..'))
main_file = join(MAINDIR, 'steadymark', '__init__.py')
def run(path):
out = open('/dev/null')
return check_call([sys.executable, main_file, path],
stdout=out, stderr=out)
def run(path, *args):
params = [sys.executable, main_file] + list(args) + [path]
out = open(os.devnull, 'w')
return check_call(params, stdout=out, stderr=out)
def test_failure_exits_with_1():
@ -54,3 +54,11 @@ def test_success_exits_with_0():
status = run(join(CURDIR, 'passes.md'))
status.should.equal(0)
def test_import_boot_file():
(u"SteadyMark should be able to import a python file before running the tests")
path = join(CURDIR, 'passes.md')
run.when.called_with(path, "-b", join(CURDIR, 'firstboot.py')).should.throw(
CalledProcessError, 'exit status 42')