<commit_before>__author__ = '<NAME>'

import os
import pytest
import sys
import time

from pyjob.exception import PyJobError
from pyjob.local import CPU_COUNT, LocalTask


class TestLocalTaskTermination(object):
    @pytest.mark.skipif(pytest.on_windows, reason='Deadlock on Windows')
    def test_terminate_1(self):
        scripts = [pytest.helpers.get_py_script(i, 10000) for i in range(4)]
        [s.write() for s in scripts]
        paths = [s.path for s in scripts]
        logs = [s.path.replace('.py', '.log') for s in scripts]
        task = LocalTask(paths, processes=CPU_COUNT)
        task.run()
        task.wait()
        assert all(os.path.isfile(f) for f in logs)
        pytest.helpers.unlink(paths + logs)

    @pytest.mark.skipif(pytest.on_windows, reason='Deadlock on Windows')
    def test_terminate_2(self):
        scripts = [pytest.helpers.get_py_script(i, 10000) for i in range(4)]
        [s.write() for s in scripts]
        paths = [s.path for s in scripts]
        logs = [s.path.replace('.py', '.log') for s in scripts]<commit_msg>first test on windows for LocalTask enabled<commit_after>__author__ = '<NAME>'

import os
import pytest
import sys
import time

from pyjob.exception import PyJobError
from pyjob.local import CPU_COUNT, LocalTask


class TestLocalTaskTermination(object):
    def test_terminate_1(self):
        scripts = [pytest.helpers.get_py_script(i, 10000) for i in range(4)]
        [s.write() for s in scripts]
        paths = [s.path for s in scripts]
        logs = [s.path.replace('.py', '.log') for s in scripts]
        task = LocalTask(paths, processes=CPU_COUNT)
        task.run()
        task.wait()
        assert all(os.path.isfile(f) for f in logs)
        pytest.helpers.unlink(paths + logs)

    @pytest.mark.skipif(pytest.on_windows, reason='Deadlock on Windows')
    def test_terminate_2(self):
        scripts = [pytest.helpers.get_py_script(i, 10000) for i in range(4)]
        [s.write() for s in scripts]
        paths = [s.path for s in scripts]
        logs = [s.path.replace('.py', '.log') for s in scripts]
{'fraction_non_alphanumeric': 0.11821239788563191, 'fraction_numerical': 0.013455069678039404, 'mean_word_length': 3.0505836575875485, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '4300864', 'n_tokens_mistral': 694, 'n_tokens_neox': 689, 'n_words': 193}