<commit_before>import pytest_cram

pytest_plugins = "pytester"


def test_version():
    assert pytest_cram.__version__


def test_cramignore(testdir):
    testdir.makeini("""
        [pytest]
        cramignore =
            sub/a*.t
            a.t
            c*.t
    """)
    testdir.tmpdir.ensure("sub/a.t")
    testdir.tmpdir.ensure("sub/a0.t")
    testdir.tmpdir.ensure("a.t")
    testdir.tmpdir.ensure("a0.t")
    testdir.tmpdir.ensure("b.t")
    testdir.tmpdir.ensure("b0.t")
    testdir.tmpdir.ensure("c.t")
    testdir.tmpdir.ensure("c0.t")

    result = testdir.runpytest()
    assert result.ret == 0
    result.stdout.fnmatch_lines([
        "*collected 3*",
        "a0.t s",
        "b.t s",
        "b0.t s",
        "*3 skipped*",
    ])
<commit_msg>Test the --nocram command line option<commit_after>import pytest_cram

pytest_plugins = "pytester"


def test_version():
    assert pytest_cram.__version__


def test_nocram(testdir):
    """Ensure that --nocram collects .py but not .t files."""
    testdir.makefile('.t', "  $ true")
    testdir.makepyfile("def test_(): assert True")
    result = testdir.runpytest("--nocram")
    assert result.ret == 0
    result.stdout.fnmatch_lines(["test_nocram.py .", "*1 passed*"])


def test_cramignore(testdir):
    """Ensure that the cramignore option ignore the appropriate cram tests."""
    testdir.makeini("""
        [pytest]
        cramignore =
            sub/a*.t
            a.t
            c*.t
    """)
    testdir.tmpdir.ensure("sub/a.t")
    testdir.tmpdir.ensure("sub/a0.t")
    testdir.tmpdir.ensure("a.t")
    testdir.tmpdir.ensure("a0.t")
    testdir.tmpdir.ensure("b.t")
    testdir.tmpdir.ensure("b0.t")
    testdir.tmpdir.ensure("c.t")
    testdir.tmpdir.ensure("c0.t")

    result = testdir.runpytest()
    assert result.ret == 0
    result.stdout.fnmatch_lines([
        "*collected 3*",
        "a0.t s",
        "b.t s",
        "b0.t s",
        "*3 skipped*",
    ])

{'fraction_non_alphanumeric': 0.1609606540623403, 'fraction_numerical': 0.010219724067450179, 'mean_word_length': 2.3642611683848798, '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': '3290413', 'n_tokens_mistral': 735, 'n_tokens_neox': 741, 'n_words': 120}