This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author John Hagen
Recipients John Hagen
Date 2017-01-02.00:28:17
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1483316898.11.0.0292789374137.issue29130@psf.upfronthosting.co.za>
In-reply-to
Content
I recently tried to port one of my packages to Python 3.6 and unit tests that worked in Python 2.7, 3.3-3.5 began failing in 3.6.

I originally thought it was a problem with coverage, but it turns out it was not. The full thread is: https://bitbucket.org/ned/coveragepy/issues/545/coverage-fails-on-python-36-travis-build

The highlight is this unit test causes Python to exit with status code 120 (which fails a Travis build):

class ParseArgumentsTestCase(unittest.TestCase):
    def test_no_arguments(self):  # type: () -> None
        with self.assertRaises(SystemExit):
            # Suppress argparse stderr.
            class NullWriter:
                def write(self, s):  # type: (str) -> None
                    pass

            sys.stderr = NullWriter()
            parse_arguments()

Ned found this corresponding note in the Python 3.6 release notes:

Changed in version 3.6: If an error occurs in the cleanup after the Python interpreter has caught SystemExit (such as an error flushing buffered data in the standard streams), the exit status is changed to 120.

If this is indeed, correct behavior and Python 3.6 is catching something incorrect (I agree this is not necessarily the most elegant unit test) then I am happy to close this issue. Just wanted to be sure I at least reported it in case this was a real issue.
History
Date User Action Args
2017-01-02 00:28:18John Hagensetrecipients: + John Hagen
2017-01-02 00:28:18John Hagensetmessageid: <1483316898.11.0.0292789374137.issue29130@psf.upfronthosting.co.za>
2017-01-02 00:28:18John Hagenlinkissue29130 messages
2017-01-02 00:28:17John Hagencreate