<commit_before>import os
import sys
import copy
import shutil
import tempfile
import subprocess
import contextlib

from avalon import io, inventory, schema
from avalon.vendor import toml

from nose.tools import (
    assert_equals,
    assert_raises,
    with_setup,
)

PROJECT_NAME = "hulk"

self = sys.modules[__name__]
self._project = {
    "schema": "avalon-core:project-2.0",
    "type": "project",
    "name": PROJECT_NAME,
    "config": {
        "template": {},
        "tasks": [],
        "apps": [],
        "copy": {}
    },
    "data": {},
}
self._config = {
    "schema": "avalon-core:config-1.0",
    "apps": [
        {"name": "app1"},
        {"name": "app2"},
    ],
    "tasks": [
        {"name": "task1"},
        {"name": "task2"},
    ],
    "template": {
        "work":
            "{root}/{project}/{silo}/{asset}/work/"
            "{task}/{user}/{app}",
        "publish":
            "{root}/{project}/{silo}/{asset}/publish/"
            "{subset}/v{version:0>3}/{subset}.{representation}"
    },
    "copy": {}
}

self._inventory = {
    "schema": "avalon-core:inventory-1.0",
    "assets": [
        {"name": "asset1"},
    ],
    "film": [
        {"name": "shot1"},
    ]
}


def setup():
    assert_equals.__self__.maxDiff = None
    os.environ["AVALON_PROJECT"] = PROJECT_NAME
    io.install()
    self._tempdir = tempfile.mkdtemp()


def teardown():
    shutil.rmtree(self._tempdir)
    io.delete_many({})  # Faster than `drop()`


@contextlib.contextmanager
def clean():
    io.delete_many({})<commit_msg>Add placeholder keys in tests setup() to avoid warnings on Session schema<commit_after>import os
import sys
import copy
import shutil
import tempfile
import subprocess
import contextlib

from avalon import io, inventory, schema
from avalon.vendor import toml

from nose.tools import (
    assert_equals,
    assert_raises,
    with_setup,
)

PROJECT_NAME = "hulk"

self = sys.modules[__name__]
self._project = {
    "schema": "avalon-core:project-2.0",
    "type": "project",
    "name": PROJECT_NAME,
    "config": {
        "template": {},
        "tasks": [],
        "apps": [],
        "copy": {}
    },
    "data": {},
}
self._config = {
    "schema": "avalon-core:config-1.0",
    "apps": [
        {"name": "app1"},
        {"name": "app2"},
    ],
    "tasks": [
        {"name": "task1"},
        {"name": "task2"},
    ],
    "template": {
        "work":
            "{root}/{project}/{silo}/{asset}/work/"
            "{task}/{user}/{app}",
        "publish":
            "{root}/{project}/{silo}/{asset}/publish/"
            "{subset}/v{version:0>3}/{subset}.{representation}"
    },
    "copy": {}
}

self._inventory = {
    "schema": "avalon-core:inventory-1.0",
    "assets": [
        {"name": "asset1"},
    ],
    "film": [
        {"name": "shot1"},
    ]
}


def setup():
    assert_equals.__self__.maxDiff = None
    os.environ["AVALON_PROJECT"] = PROJECT_NAME

    # Fill in other required keys for the Session schema to avoid warnings
    # todo: figure out why these are actually required in the schema here
    for key in ["AVALON_PROJECTS",
                "AVALON_ASSET",
                "AVALON_SILO",
                "AVALON_CONFIG"]:
        os.environ[key] = "placeholder"

    io.install()
    self._tempdir = tempfile.mkdtemp()


def teardown():
    shutil.rmtree(self._tempdir)
    io.delete_many({})  # Faster than `drop()`


@contextlib.contextmanager
def clean():
    io.delete_many({})
{'fraction_non_alphanumeric': 0.17843759008359758, 'fraction_numerical': 0.00807149034303834, 'mean_word_length': 2.445878848063555, 'pattern_counts': {'":': 50, '<': 3, '<?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': '2950254', 'n_tokens_mistral': 1183, 'n_tokens_neox': 1173, 'n_words': 237}