<commit_before>from __future__ import with_statement


import os
import signal

import nose
from nose.tools import assert_equal, assert_raises

from pyfits.tests import PyfitsTestCase
from pyfits.tests.util import catch_warnings
from pyfits.util import ignore_sigint


class TestUtils(PyfitsTestCase):
    def test_ignore_sigint(self):
        if not hasattr(os, 'kill'):
            # Not available in some Python versions on Windows
            raise nose.SkipTest('os.kill() not available')

        @ignore_sigint
        def test():
            with catch_warnings(record=True) as w:
                pid = os.getpid()
                os.kill(pid, signal.SIGINT)
                # One more time, for good measure<commit_msg>Turns out I can't run this test on Python at all. The os.kill() on Windows just terminates the process, and doesn't do the Windows equivalent of a SIGINT.  If I pass it signal.CTRL_C_EVENT it *should* work on windows, but that just results in a WindowsError, so I'm at a loss.  Better to just disable it.  I didn't notice that this was causing the process to terminate since it's the last test anyways.  But this explains a lot.<commit_after>from __future__ import with_statement


import os
import signal
import sys

import nose
from nose.tools import assert_equal, assert_raises

from pyfits.tests import PyfitsTestCase
from pyfits.tests.util import catch_warnings
from pyfits.util import ignore_sigint


class TestUtils(PyfitsTestCase):
    def test_ignore_sigint(self):
        if sys.platform.startswith('win'):
            # Not available in some Python versions on Windows
            raise nose.SkipTest('os.kill() not available')

        @ignore_sigint
        def test():
            with catch_warnings(record=True) as w:
                pid = os.getpid()
                os.kill(pid, signal.SIGINT)
                # One more time, for good measure
{'fraction_non_alphanumeric': 0.06299629433562731, 'fraction_numerical': 0.0, 'mean_word_length': 2.9293139293139294, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5298548', 'n_tokens_mistral': 532, 'n_tokens_neox': 503, 'n_words': 203}