<commit_before>import os
import re
import ssl
import sys
import tempfile
from doctest import testfile
from io import StringIO, TextIOWrapper
from unittest import TestCase
from unittest.mock import DEFAULT, Mock, patch

from urllib3.exceptions import LocationParseError

from crate.client.exceptions import ProgrammingError
from crate.crash.command import (
    CrateShell,
    _create_shell,
    get_parser,
    get_stdin,
    host_and_port,
    main,
    noargs_command,
)
from crate.crash.commands import Command
from crate.crash.outputs import _val_len as val_len
from crate.crash.printer import ColorPrinter
from crate.testing.layer import CrateLayer

crate_http_port = 44209
crate_transport_port = 44309
crate_settings = {
    'cluster.name': 'Testing44209',
    'node.name': 'crate',
    'psql.port': 45441,
    'lang.js.enabled': True,
    'http.port': crate_http_port,
    'transport.tcp.port': crate_transport_port
}
node = CrateLayer.from_uri(
    'https://cdn.crate.io/downloads/releases/crate-4.0.2.tar.gz',
    'crate',
    settings=crate_settings
)


def setUpModule():
    node.start()


def tearDownModule():
    node.stop()


def fake_stdin(data):
    stdin = TextIOWrapper(tempfile.TemporaryFile())
    stdin.write(data)
    stdin.flush()<commit_msg>Update CrateDB version used in tests to 4.2.0<commit_after>import os
import re
import ssl
import sys
import tempfile
from doctest import testfile
from io import StringIO, TextIOWrapper
from unittest import TestCase
from unittest.mock import DEFAULT, Mock, patch

from urllib3.exceptions import LocationParseError

from crate.client.exceptions import ProgrammingError
from crate.crash.command import (
    CrateShell,
    _create_shell,
    get_parser,
    get_stdin,
    host_and_port,
    main,
    noargs_command,
)
from crate.crash.commands import Command
from crate.crash.outputs import _val_len as val_len
from crate.crash.printer import ColorPrinter
from crate.testing.layer import CrateLayer

crate_http_port = 44209
crate_transport_port = 44309
crate_settings = {
    'cluster.name': 'Testing44209',
    'node.name': 'crate',
    'psql.port': 45441,
    'lang.js.enabled': True,
    'http.port': crate_http_port,
    'transport.tcp.port': crate_transport_port
}
node = CrateLayer.from_uri(
    'https://cdn.crate.io/downloads/releases/crate-4.2.0.tar.gz',
    'crate',
    settings=crate_settings
)


def setUpModule():
    node.start()


def tearDownModule():
    node.stop()


def fake_stdin(data):
    stdin = TextIOWrapper(tempfile.TemporaryFile())
    stdin.write(data)
    stdin.flush()
{'fraction_non_alphanumeric': 0.09423676012461059, 'fraction_numerical': 0.01985981308411215, 'mean_word_length': 4.221544715447155, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6169387', 'n_tokens_mistral': 887, 'n_tokens_neox': 861, 'n_words': 204}