Ë
   ãßíò:Qã                  óè   — d Z ddlmZ ddlZddlmc mZ ddl	Z	e	j                  j                  dd«       ddlmZ ddlZddlmZ  ej"                  d¬	«      dd
„«       Zej"                  dd„«       Zy)a  Shared fixtures for the test suite.

Keep this file minimal and free of application imports at module import time:
a fixture that reaches into the process environment must be requested
explicitly so a test can see exactly which confinement it is exercising.
é    )ÚannotationsNÚCYBERBRAIN_CHAIN_KEYú'test-chain-key-for-testing-only-32bytes)ÚPath)Úensure_workspaces_rootT)Úautousec                óü   — |j                  dt        | «      «       |j                  dt        | dz  «      «       |j                  dt        | dz  «      «       |j                  dd¬«       |j                  d	d
«       y)zžRedirect every writable path into ``tmp_path`` for all tests.

    Prevents cross-test contamination of the shared host database and
    workspaces root.
    ÚCYBERBRAIN_DATA_DIRÚCYBERBRAIN_DB_PATHúcyberbrain.sqlite3ÚCYBERBRAIN_WORKSPACES_ROOTÚ
workspacesÚCYBERBRAIN_RETENTION_DAYSF©Úraisingr   r   N)ÚsetenvÚstrÚdelenv)Útmp_pathÚmonkeypatchs     ú0/home/oem/CyberBrain26-unified/tests/conftest.pyÚisolated_envr      sv   € ð ×ÑÐ,¬c°(«mÔ<Ø×ÑÐ+¬S°Ð<PÑ1PÓ-QÔRØ×ÑÐ3´S¸ÀLÑ9PÓ5QÔRØ×ÑÐ2¸EÐÔBà×ÑÐ-Ð/XÕYó    c                óÒ  — | dz  }|j                  dt        |«      «       dD ]  }|j                  |d¬«       Œ |j                  dt        |dz  «      «       |j                  dt        |d	z  «      «       d}t        j                  }||v }|sµt        j                  d
|fd||f«      t        j                  |«      dt        j                  «       v st        j                  t        «      rt        j                  t        «      ndt        j                  |«      dœz  }dd|iz  }t        t        j                  |«      «      ‚dx}x}}t        «       }	|	j                  dd¬«       |	S )aÚ  Return an isolated, per-test sanctioned workspaces root.

    The sandbox provider confines every writable workspace to
    ``<data dir>/workspaces``, so a test that wants a working workspace must
    build it under that root. The data directory is redirected into ``tmp_path``
    and the related variables are cleared so a developer's real
    ``~/.local/share/CyberBrain26`` is never written to and a stray host
    configuration cannot decide the outcome of a test.
    Údatar
   )r   r   r   Fr   r   r   r   r   )Úin)z/%(py1)s in %(py5)s
{%(py5)s = %(py3)s.environ
}Úos)Úpy1Úpy3Úpy5zassert %(py7)sÚpy7NT)ÚparentsÚexist_ok)r   r   r   r   ÚenvironÚ
@pytest_arÚ_call_reprcompareÚ	_safereprÚ@py_builtinsÚlocalsÚ_should_repr_global_nameÚAssertionErrorÚ_format_explanationr   Úmkdir)
r   r   Údata_dirÚnameÚ@py_assert0Ú@py_assert4Ú@py_assert2Ú@py_format6Ú@py_format8Úroots
             r   Úsandbox_workspaces_rootr6   %   s	  € ð ˜&Ñ €HØ×ÑÐ,¬c°(«mÔ<Øaò 0ˆØ×Ñ˜4¨ÐÕ/ð0à×ÑÐ+¬S°Ð<PÑ1PÓ-QÔRØ×ÑÐ3´S¸ÀLÑ9PÓ5QÔRØ Ð.¤B§J¡JÐ.Ð  JÐ.×.×.Õ.Ð  J×.×.Ó.Ð ×.×.×.×.×.Ð.¤B×.×.Ó.¤B×.×.Ô. J×.×.×.×.×.×.Ó.Ü!Ó#€DØ‡J�J�t d€JÔ+Ø€Kr   )r   r   r   úpytest.MonkeyPatchÚreturnÚNone)r   r   r   r7   r8   r   )Ú__doc__Ú
__future__r   Úbuiltinsr(   Ú_pytest.assertion.rewriteÚ	assertionÚrewriter%   r   r$   Ú
setdefaultÚpathlibr   ÚpytestÚ cyberbrain26.product.local_storer   Úfixturer   r6   © r   r   ú<module>rF      sp   ðñõ #ç  „ ƒ	ð ‡
�
× Ñ Ð,Ð.WÔ Xå ã å Cð €‡�˜ÔòZó ðZð ‡�òó ñr   