File size: 514 Bytes
f56e4d7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
"""Remove files created when testing lichess-bot."""
import shutil
import os
from _pytest.config import ExitCode
from _pytest.main import Session


def pytest_sessionfinish(session: Session, exitstatus: int | ExitCode) -> None:  # noqa: ARG001
    """
    Remove files created when testing lichess-bot.

    The only exception is if running in a GitHub action, in which case we save the engines to the cache.
    """
    if os.path.exists("TEMP") and not os.getenv("GITHUB_ACTIONS"):
        shutil.rmtree("TEMP")