<commit_before>#coding:utf-8
import sys
import os
import os.path
import subprocess
from cactus.tests import BaseTestCase
from cactus.utils.filesystem import fileList


class CliTestCase(BaseTestCase):
    def find_cactus(self):
        """
        Locate a Cactus executable and ensure that it'll run using the right interpreter.
        This is meant to work well in a Tox environment. That's how we run our tests, so that's all that really
        matters here.
        """
        path = os.path.abspath(os.path.join(os.path.dirname(sys.executable), "cactus"))
        with open(path) as f:
            self.assertEqual("#!{0}".format(sys.executable), f.readline().strip())
        return path

    def run_cli(self, args, stdin="", cwd=None):
        real_args = [self.find_cactus()]
        real_args.extend(args)

        kwargs = {
            "args": real_args,
            "stdin":subprocess.PIPE,<commit_msg>Update test_cli to work on Windows<commit_after>#coding:utf-8
import sys
import os
import os.path
import subprocess
from cactus.tests import BaseTestCase
from cactus.utils.filesystem import fileList


class CliTestCase(BaseTestCase):
    def find_cactus(self):
        """
        Locate a Cactus executable and ensure that it'll run using the right interpreter.
        This is meant to work well in a Tox environment. That's how we run our tests, so that's all that really
        matters here.
        """
        bin_path = os.path.abspath(os.path.dirname(sys.executable))

        try:
            path = os.path.join(bin_path, "cactus")
            with open(path) as f:
                self.assertEqual("#!{0}".format(sys.executable), f.readline().strip())
        except IOError:
            pass
        else:
            return path

        try:
            path = os.path.join(bin_path, "cactus.exe")
            with open(path):
                pass
        except IOError:
            pass
        else:
            return path

        self.fail("Unable to find Cactus")

    def run_cli(self, args, stdin="", cwd=None):
        real_args = [self.find_cactus()]
        real_args.extend(args)

        kwargs = {
            "args": real_args,
            "stdin":subprocess.PIPE,
{'fraction_non_alphanumeric': 0.10031631269769543, 'fraction_numerical': 0.0018075011296882061, 'mean_word_length': 2.2415812591508053, 'pattern_counts': {'":': 4, '<': 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': '2231508', 'n_tokens_mistral': 676, 'n_tokens_neox': 653, 'n_words': 188}