Changeset 10:3c5d9b2b69b8 in pyenvjasmine


Ignore:
Timestamp:
Apr 22, 2015, 1:12:54 PM (10 years ago)
Author:
Borja Lopez <borja@…>
Branch:
default
Phase:
public
Message:

Make tests compatible with python 3

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pyenvjasmine/tests/test_runner.py

    r0 r10  
    1818        jstests = TestRunner()
    1919        output = jstests.run()
    20         self.assertTrue('Failed: 0' in output)
    21         self.assertTrue('Passed: 5' in output)
     20        # output is the resulting stdout from a subprocess call, which is a
     21        # bytes object, hence the b'' for the checks
     22        self.assertTrue(b'Failed: 0' in output)
     23        self.assertTrue(b'Passed: 5' in output)
    2224
    2325    def test_runner_params(self):
     
    3638        output = jstests.run(spec='tests/specs/test_demo.spec.js')
    3739        lines = output.splitlines()
    38         self.assertTrue(lines[0].endswith('specs/test_demo.spec.js'),
     40        # output is the resulting stdout from a subprocess call, which is a
     41        # bytes object, hence the b'' in the endswith/startswith calls
     42        self.assertTrue(lines[0].endswith(b'specs/test_demo.spec.js'),
    3943            "wrong output: %s" % str(output))
    40         self.assertTrue(lines[1].startswith('[  Envjs/1.6 (Rhino;'),
     44        self.assertTrue(lines[1].startswith(b'[  Envjs/1.6 (Rhino;'),
    4145            "wrong output: %s" % str(output))
    42         self.assertTrue('Passed: 4' in lines)
    43         self.assertTrue('Failed: 0' in lines)
    44         self.assertTrue('Total : 4' in lines)
     46        self.assertTrue(b'Passed: 4' in lines)
     47        self.assertTrue(b'Failed: 0' in lines)
     48        self.assertTrue(b'Total : 4' in lines)
    4549
    4650    def test_write_browser_htmlfile_markup_is_correct(self):
     
    6266            actual = file.read()
    6367            self.assertEqual(expected, actual)
    64        
     68
    6569    def test_runner_with_browser_configfile(self):
    6670        """
     
    102106        """
    103107        jstests = TestRunner()
    104         print '--- output expected ---'
    105108        output = jstests.run(capture_output=False)
    106         print '--- end output expected ---'
    107109        self.assertEqual(output, None)
    108 
Note: See TracChangeset for help on using the changeset viewer.