<commit_before>"""Test the profile listing and creation

Copyright (c) 2015 <NAME>
MIT Licence
"""
import pytest

import dodocs


# fixtures
@pytest.fixture
def profile_list():
    """Execute the command profile list"""
    command_line = 'profile list'
    dodocs.main(command_line.split())


@pytest.fixture
def profile_rm():
    """Execute the command profile remove"""
    command_line = 'profile remove dodocs_pytest'
    dodocs.main(command_line.split())


@pytest.fixture
def profile_edit():
    """Execute the command profile edit"""
    command_line = 'profile edit dodocs_pytest'
    dodocs.main(command_line.split())


# profile listing
def test_list_no_exist(tmp_homedir, profile_list, caplog):
    """Test that listing without a dodocs directory fails"""
    record = caplog.records()[0]
    assert record.levelname == "CRITICAL"
    assert "No dodocs directory found" in record.message


# profile removal
def test_rm_no_exists(tmp_homedir, profile_rm, caplog):
    """Test that removing without a dodocs directory print a warning as first
    message"""
    record = caplog.records()[0]
    assert record.levelname == "WARNING"
    assert "Profile does not exist" in record.message


# profile editing
def test_edit_no_exists(tmp_homedir, profile_edit, caplog):
    """Test that removing without a dodocs directory print a warning as first
    message"""
    record = caplog.records()[0]
    assert record.levelname == "CRITICAL"
    assert "No dodocs directory found" in record.message


@pytest.mark.skipif("True")
def test_list():
    "List profiles"
    command_line = 'profile list'
    dodocs.main(command_line.split())


@pytest.mark.skipif("True")
def test_create():
    "List profiles"
    command_line = 'profile create'
    # dodocs.main(command_line.split())<commit_msg>Use new fixtures, test listing existing profile<commit_after>"""Test the profile listing and creation

Copyright (c) 2015 <NAME>
MIT Licence
"""
import pytest

import dodocs


# fixtures
@pytest.fixture
def profile_list():
    """Execute the command profile list"""
    command_line = 'profile list'
    dodocs.main(command_line.split())


@pytest.fixture
def profile_rm():
    """Execute the command profile remove"""
    command_line = 'profile remove dodocs_pytest'
    dodocs.main(command_line.split())


@pytest.fixture
def profile_edit():
    """Execute the command profile edit"""
    command_line = 'profile edit dodocs_pytest'
    dodocs.main(command_line.split())


# profile listing
def test_list_no_exist(tmp_and_clear, profile_list, caplog):
    """Test that listing without a dodocs directory fails"""
    record = caplog.records()[0]
    assert record.levelname == "CRITICAL"
    assert "No dodocs directory found" in record.message


def test_list(create_and_clear, profile_list, caplog):
    "List profiles"
    print(len(caplog.records()))
    assert all([r.levelname == "INFO" for r in caplog.records()])


# profile removal
def test_rm_no_exists(tmp_and_clear, profile_rm, caplog):
    """Test that removing without a dodocs directory print a warning as first
    message"""
    record = caplog.records()[0]
    assert record.levelname == "WARNING"
    assert "Profile does not exist" in record.message


# profile editing
def test_edit_no_exists(tmp_and_clear, profile_edit, caplog):
    """Test that removing without a dodocs directory print a warning as first
    message"""
    record = caplog.records()[0]
    assert record.levelname == "CRITICAL"
    assert "No dodocs directory found" in record.message


@pytest.mark.skipif("True")
def test_create():
    "List profiles"
    command_line = 'profile create'
    # dodocs.main(command_line.split())
{'fraction_non_alphanumeric': 0.10787251430128031, 'fraction_numerical': 0.003813674748025061, 'mean_word_length': 4.36058394160584, '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': '3180639', 'n_tokens_mistral': 1143, 'n_tokens_neox': 1127, 'n_words': 332}