<commit_before># -*- coding: utf-8 -*-

import gc
import sys
import psutil
import pymssql
import pytest


@pytest.mark.xfail(sys.platform == "win32", reason="Memory test is not stable on Windows")
def test_memory_leak_on_unsuccessful_connect():

    p = psutil.Process()
    m0 = p.memory_full_info()
    for i in range(10):
        gc.collect()
        try:
            pymssql.connect(server="www.google.com", port=81, user='username',
                            password='password', login_timeout=1)<commit_msg>test_memory: mark it xfail.<commit_after># -*- coding: utf-8 -*-

import gc
import sys
import psutil
import pymssql
import pytest


@pytest.mark.xfail(reason="Memory test is not stable")
def test_memory_leak_on_unsuccessful_connect():
    """
    This test checks python process memory usage and not just unsuccessful
    connect path. Many other factors (i.e. garbage collection) affect memory
    usage pattern. So this is an indirect test which is somewhat flaky and
    because of that is marked 'xfail'.
    """
    p = psutil.Process()
    m0 = p.memory_full_info()
    for i in range(10):
        gc.collect()
        try:
            pymssql.connect(server="www.google.com", port=81, user='username',
                            password='password', login_timeout=1)
{'fraction_non_alphanumeric': 0.1078355314197052, 'fraction_numerical': 0.012412723041117145, 'mean_word_length': 2.944954128440367, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '1737923', 'n_tokens_mistral': 398, 'n_tokens_neox': 391, 'n_words': 116}