Changeset 26:14c16e5cbe03 in pyenvjasmine for README.rst
- Timestamp:
- Jan 18, 2018, 12:22:26 PM (6 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
README.rst
r24 r26 38 38 want to test), install pyenvjasmine and then run:: 39 39 40 nosetests --cover-package=pyenvjasmine --cover-erase \ 41 --with-coverage --with-doctest $* 42 43 .. note:: 44 45 If you have installed pyenvjasmine in *development mode*, you can simply 46 run:: 47 48 nosetests -c nose.cfg 49 50 to run the tests from within the pyenvjasmine sources directory. 40 py.test 51 41 52 42 … … 61 51 from the js tests on the console. Something like this:: 62 52 63 import unittest53 import pytest 64 54 from pyenvjasmine.runner import Runner 65 55 66 class JavaScriptTests(unittest.TestCase):56 class TestJavaScript(object): 67 57 def test_my_javascript(self): 68 58 runner = Runner( 69 59 testdir='/path/to/my/testdir', 70 60 configfile='relative/path/to/configfile') 71 runner.run(capture_output=False) 72 73 74 If you want a more integrated test control, you could set capture_output to 75 True, then parse the test output that is returned from the run() method, with 76 something like this:: 77 78 import unittest 79 from pyenvjasmine.runner import Runner 80 81 class JavaScriptTests(unittest.TestCase): 82 def test_my_javascript_no_output(self): 83 runner = Runner( 84 testdir='/path/to/my/testdir', 85 configfile='relative/path/to/configfile') 86 res = runner.run(capture_output=True) 87 lines = res.splitlines() 88 self.assertTrue('Failed: 0' in lines) 61 success, stdout = runner.run() 62 # assert on success, will be true if tests passed, False if any 63 # test failed 64 assert success 65 # you can inspect stdout if you want to get more info, but it 66 # will be printed to the console stdout anyway 67 assert b'Total: 120' in stdout 89 68 90 69
Note:
See TracChangeset
for help on using the changeset viewer.