+
    :1ji                    l   R t ^ RIHt ^ RIt^ RIt^ RIt^ RIt^ RIHtH	t	 ^ RI
Ht ^ RIHt ^ RIHt ^ RIHt ^ RIHt ^ R	IHtHtHtHt ^ RIt^ RIt^R
IHt ^RIHt ^RIH t H!t! ^RI"H#t#H$t$ ^RI%H&t& ^RI'H(t( ^RI)H*t*H+t+ ^RI,H-t- ^RI.H/t/ ^RI0H1t1 ^RI2H3t3 ^RI4H5t5 ^RI6H7t7 ^RI8H9t9 ]'       d'   ^ RI:t;^ RI<H=t=H>t> ^ RIH?t?H@t@HAtAHBtBHCtC ^ RIDHEtE ^RIFHGtG ]! ]H4      tI]! R4      tJ]P                  ! RR7      R 4       tL]P                  ! R R!7      R" 4       tM]P                  ! RR7      R# 4       tN]P                  ! R R!7      R$ 4       tO]P                  ! 4       R% R& l4       tP]P                  ! ]P                  P                  R'R(4      P                  R)4      R*7      R+ R, l4       tT]P                  R- R. l4       tU]P                  R/ R0 l4       tV]P                  R1 R2 l4       tW]! R3]R4,          ]R5,          ]R6,          4      tXR7 R8 ltY] ! R9 R:4      4       tZ]P                  R; R< l4       t[]P                  ! R=R!7      R> R? l4       t\] ! R@ RA4      4       t]]P                  ! R=R!7      RB RC l4       t^] ! RD RE4      4       t_]P                  RF RG l4       t`] ! RH RI4      4       ta]P                  RJ RK l4       tb]P                  RL RM l4       tc]P                  ! R=R!7      RN RO l4       td] ! RP RQ4      4       te]P                  RR RS l4       tf]P                  ! RTRU7      RV RW l4       tg]P                  RX RY l4       th]P                  RZ R[ l4       ti]P                  ! R=RR\7      R] 4       tj]P                  R^ R_ l4       tk] ! R` Ra4      4       tl]P                  Rb Rc l4       tmR# )dz2Collection of pytest fixtures used in conda tests.)annotationsN)contextmanagernullcontext)	dataclass)chain)	getLogger)Path)copyfile)TYPE_CHECKINGLiteralTypeVaroverload)CONDA_SOURCE_ROOT)dals)PACKAGE_CACHE_MAGIC_FILEPREFIX_MAGIC_FILE)contextreset_context)main_subshell)YamlRawParameter)jsonyaml)path_to_url)PackageCacheData)
SubdirData)CondaExitZero)TemporaryDirectory)PackageRecord)PYTHON_BINARY)IterableIterator)CaptureFixtureExceptionInfoFixtureRequestMonkeyPatchTempPathFactory)MockerFixture)PathTypea  
    custom_channels:
      darwin: https://some.url.somewhere/stuff
      chuck: http://another.url:8080/with/path
    custom_multichannels:
      michele:
        - https://do.it.with/passion
        - learn_from_every_thing
      steve:
        - more-downloads
    channel_settings:
      - channel: darwin
        param_one: value_one
        param_two: value_two
      - channel: "http://localhost"
        param_one: value_one
        param_two: value_two
    migrated_custom_channels:
      darwin: s3://just/cant
      chuck: file:///var/lib/repo/
    migrated_channel_aliases:
      - https://conda.anaconda.org
    channel_alias: ftp://new.url:8082
    conda-build:
      root-dir: /some/test/path
    proxy_servers:
      http: http://user:pass@corp.com:8080
      https: none
      ftp:
      sftp: ''
      ftps: false
      rsync: 'false'
    aggressive_update_packages: []
    channel_priority: false
    T)autousec                 >    \         P                  ! R\        R7       R# )z
Suppress `Unclosed Socket Warning`

It seems urllib3 keeps a socket open to avoid costly recreation costs.

xref: https://github.com/kennethreitz/requests/issues/1882
ignore)categoryN)warningsfilterwarningsResourceWarning     6lib/python3.14/site-packages/conda/testing/fixtures.pysuppress_resource_warningr2   _   s     H?r0   function)scopec                    \        \        V 4      R 7      p VP                  V P                  4       \        P
                  P                  V P                  4      # ))dir)r   straddfinalizercleanuppypathlocalname)tmpdirrequests   &&r1   r>   r>   k   s9    CK0F(77==%%r0   c                 0    \         P                  ! 4        R # N)r   clear_cached_local_channel_datar/   r0   r1   clear_subdir_cacherC   r   s    ..0r0   c               #  *   "   Rx  \        4        R# 5i)z:Resets the context object after each test function is run.N)r   r/   r0   r1   reset_conda_contextrE   w   s      
Os   c                    V ^8  d   QhRRRR/# )   monkeypatchr$   returnIterator[Path]r/   )formats   "r1   __annotate__rL      s      k n r0   c              #     "   V P                  R4      pVP                  R\        V4      4       \        4        Vx  R# 5i)z:
Used to isolate package or index cache from other tests.
pkgsCONDA_PKGS_DIRSN)mktempsetenvr7   r   )tmp_path_factoryrH   pkgs_dirs   && r1   temp_package_cacherT      s6     
  &&v.H(#h-8O
Ns   =?CONDA_TEST_SOLVERSzlibmamba,classic,)paramsc                    V ^8  d   QhRRRR/# )rG   r?   r#   rI   z(Iterable[Literal['libmamba', 'classic']]r/   )rK   s   "r1   rL   rL      s     6 66-6r0   c              #  L   "   \        W P                  4       Rj  xL
  R#  L5i)a4  
A parameterized fixture that sets the solver backend to (1) libmamba
and (2) classic for each test. It's using autouse=True, so only import it in
modules that actually need it.

Note that skips and xfails need to be done _inside_ the test body.
Decorators can't be used because they are evaluated before the
fixture has done its work!

So, instead of:

    @pytest.mark.skipif(context.solver == "libmamba", reason="...")
    def test_foo():
        ...

Do:

    def test_foo():
        if context.solver == "libmamba":
            pytest.skip("...")
        ...
N)_solver_helperparamr?   s   &r1   parametrized_solver_fixturer]      s     : g}}555s   $"$c                    V ^8  d   QhRRRR/# )rG   r?   r#   rI   zIterable[Literal['classic']]r/   )rK   s   "r1   rL   rL           2 22!2r0   c              #  :   "   \        V R 4       Rj  xL
  R#  L5i)classicNrZ   r\   s   &r1   solver_classicrc            gy111   c                    V ^8  d   QhRRRR/# )rG   r?   r#   rI   zIterable[Literal['libmamba']]r/   )rK   s   "r1   rL   rL      s     3 33"3r0   c              #  :   "   \        V R 4       Rj  xL
  R#  L5i)libmambaNrb   r\   s   &r1   solver_libmambari      s      gz222re   c                    V ^8  d   QhRRRR/# )rG   r?   r#   rI   zIterable[Literal['rattler']]r/   )rK   s   "r1   rL   rL      r_   r0   c              #  :   "   \        V R 4       Rj  xL
  R#  L5i)rattlerNrb   r\   s   &r1   solver_rattlerrm      rd   re   Solverrh   ra   rl   c               $    V ^8  d   QhRRRRRR/# )rG   r?   r#   solverrn   rI   zIterable[Solver]r/   )rK   s   "r1   rL   rL      s&       r0   c              #  T  "   \         P                  P                  P                  4        V P	                  \         P                  P                  P                  4       V P                  R 4      pVP                  RV4       \        4        \         P                  V8X  g   Q hVx  R# 5i)rH   CONDA_SOLVERN)	r   plugin_managerget_cached_solver_backendcache_clearr8   getfixturevaluerQ   r   rp   )r?   rp   mps   && r1   rZ   rZ      sy     
 44@@B//IIUUV		 	 	/BIInf%O>>V###
Ls   B&B(c                  x    ] tR t^t$ R]R&   ]R R l4       t]R R l4       tRR/R	 R
 llt]R R l4       tRt	R# )CondaCLIFixturezCaptureFixture | Nonecapsysc               $    V ^8  d   QhRRRRRR/# )rG   argvr'   raisesz5type[BaseException] | tuple[type[BaseException], ...]rI   tuple[str, str, ExceptionInfo]r/   )rK   s   "r1   rL   CondaCLIFixture.__annotate__   s)     - -- F- 
(	-r0   c               	    R # rA   r/   )selfr}   r|   s   &$*r1   __call__CondaCLIFixture.__call__   s    
 *-r0   c                    V ^8  d   QhRRRR/# )rG   r|   r'   rI   tuple[str, str, int]r/   )rK   s   "r1   rL   r      s     # ## 
#r0   c                	    R # rA   r/   )r   r|   s   &*r1   r   r      s      #r0   r}   Nc               $    V ^8  d   QhRRRRRR/# )rG   r|   r'   r}   z<type[BaseException] | tuple[type[BaseException], ...] | NonerI   2tuple[str | None, str | None, int | ExceptionInfo]r/   )rK   s   "r1   rL   r      s)     7 77 M7 
<	7r0   c                  V P                   '       d   V P                   P                  4        RpV'       d   \        P                  ! V4      M	\	        4       ;_uu_ 4       p\        V P                  V4      !  pRRR4       V P                   '       d   V P                   P                  4       w  rVMR;rV\        4        YVV'       d   X3# T3#   + '       g   i     L[; i)ax  Test conda CLI. Mimic what is done in `conda.cli.main.main`.

`conda ...` == `conda_cli(...)`

:param argv: Arguments to parse.
:param raises: Expected exception to intercept. If provided, the raised exception
    will be returned instead of exit code (see pytest.raises and pytest.ExceptionInfo).
:return: Command results (stdout, stderr, exit code or pytest.ExceptionInfo).
N)rz   
readouterrpytestr}   r   r   
_cast_argsr   )r   r}   r|   code	exceptionouterrs   &$*    r1   r   r      s     ;;;KK""$ &,V]]6"+-??9 $//$"78D @ ;;;{{--/HCC 	f66$66 @?s   CC	c                    V ^8  d   QhRRRR/# )rG   r|   ztuple[PathType, ...]rI   zIterable[str]r/   )rK   s   "r1   rL   r     s      - - r0   c                "    \        \        V 4      # )zCast args to string.)mapr7   )r|   s   &r1   r   CondaCLIFixture._cast_args  s     3~r0   r/   )
__name__
__module____qualname____firstlineno____annotations__r   r   staticmethodr   __static_attributes__r/   r0   r1   ry   ry      sT    !!- - # #
7 PT7B  r0   ry   c                    V ^8  d   QhRRRR/# )rG   rz   r!   rI   Iterator[CondaCLIFixture]r/   )rK   s   "r1   rL   rL     s     " "n ")B "r0   c              #  (   "   \        V 4      x  R# 5i)zA function scoped fixture returning CondaCLIFixture instance.

Use this for any commands that are local to the current test (e.g., creating a
conda environment only used in the test).
Nry   )rz   s   &r1   	conda_clir     s      &
!!   sessionc                   V ^8  d   QhRR/# )rG   rI   r   r/   )rK   s   "r1   rL   rL     s        4  r0   c               #  (   "   \        R4      x  R# 5i)zA session scoped fixture returning CondaCLIFixture instance.

Use this for any commands that are global to the test session (e.g., creating a
conda environment shared across tests, `conda info`, etc.).
Nr   r/   r0   r1   session_conda_clir     s      $
r   c                  Z    ] tR tRtRt]R R l4       t]R R l4       tRR/R	 R
 lltRtR# )PipCLIFixturei  z7Fixture for calling pip in specific conda environments.c               (    V ^8  d   QhRRRRRRRR/# )rG   r|   r'   prefixr}   z-type[Exception] | tuple[type[Exception], ...]rI   r~   r/   )rK   s   "r1   rL   PipCLIFixture.__annotate__$  s2     - -- - >	-
 
(-r0   c               	    R # rA   r/   )r   r   r}   r|   s   &$$*r1   r   PipCLIFixture.__call__#  s     *-r0   c               $    V ^8  d   QhRRRRRR/# )rG   r|   r'   r   rI   r   r/   )rK   s   "r1   rL   r   ,  s(     # ## # 
	#r0   c               	    R # rA   r/   )r   r   r|   s   &$*r1   r   r   +  s    
  #r0   r}   Nc               (    V ^8  d   QhRRRRRRRR/# )rG   r|   r'   r   r}   z4type[Exception] | tuple[type[Exception], ...] | NonerI   r   r/   )rK   s   "r1   rL   r   2  s3     += +=+= += E	+=
 
<+=r0   c          	        \        V4      pV\        ,          p\        V4      RR.V Uu. uF  p\        V4      NK  	  up,           pV'       d   \        P                  ! V4      M	\        4       ;_uu_ 4       p \        P                  ! VRRRR7      p	V	P                  p
V	P                  pV	P                  pRRR4       XXT'       d   X3# X
3# u upi   \        P                   d/   pTP                  p
TP                  pTP                  p Rp?L[Rp?i\         d    \        RT RT 24      hi ; i  + '       g   i     L; i)a  Test pip CLI in a specific conda environment.

`pip ...` in environment == `pip_cli(..., prefix=env_path)`

:param argv: Arguments to pass to pip.
:param prefix: Path to the conda environment containing pip.
:param raises: Expected exception to intercept. If provided, the raised exception
    will be returned instead of exit code (see pytest.raises and pytest.ExceptionInfo).
:return: Command results (stdout, stderr, exit code or pytest.ExceptionInfo).
z-mpipT)capture_outputtextcheckNz Python not found in environment z: )r   r   r7   r   r}   r   
subprocessrun
returncodestdoutstderrCalledProcessErrorFileNotFoundErrorRuntimeError)r   r   r}   r|   prefix_path
python_exeargcmdr   resultr   r   r   es   &$$*          r1   r   r   2  s    " 6l =0
:e,D/IDSCD/II '-V]]6"+-??9##'	 (( @* vFy<<<<1 0J 00 "||$ "6{m2j\R  @?s;   C7D59>CD2)$DD5D2D22D55E	r/   )r   r   r   r   __doc__r   r   r   r/   r0   r1   r   r     sA    A- - # #+= HL	+= +=r0   r   c                   V ^8  d   QhRR/# )rG   rI   zIterator[PipCLIFixture]r/   )rK   s   "r1   rL   rL   a  s      ( r0   c               #  &   "   \        4       x  R# 5i)a  A function scoped fixture returning PipCLIFixture instance.

Use this for calling pip commands in specific conda environments during tests.
Uses `python -m pip` for reliable cross-platform execution.

Example:
    def test_pip_install(tmp_env, pip_cli):
        with tmp_env("python=3.10", "pip") as prefix:
            stdout, stderr, code = pip_cli("install", "requests", prefix=prefix)
            assert code == 0
N)r   r/   r0   r1   pip_clir   `  s      /s   c                  B    ] tR tRt$ R]R&   RRRRRRR/R R	 llltR
tR# )PathFactoryFixtureip  r   tmp_pathNr   infixsuffixc          
     ,    V ^8  d   QhRRRRRRRRRR/# rG   r=   
str | Noner   r   r   rI   r   r/   )rK   s   "r1   rL   PathFactoryFixture.__annotate__t  s<     *= *=*= 	*=
 *= *= 
*=r0   c               ~   V'       d$   V'       g   V'       g	   V'       d   \        R4      hV'       d   V P                  V,          # \        P                  ! 4       P                  pT;'       g
    VR,          pT;'       g
    VR,          pT;'       g
    VR,          pV P                  W#,           V,           ,          # )u  Unique, non-existent path factory.

Extends pytest's `tmp_path` fixture with a new unique, non-existent path for usage in cases
where we need a temporary path that doesn't exist yet.

Default behavior (no arguments):
   ``path_factory()`` → ``tmp_path/ab12cd34ef56`` (12-char UUID)

Two modes of operation (mutually exclusive):

1. Name mode: Pass a complete path name.
   ``path_factory("myfile.txt")`` → ``tmp_path/myfile.txt``

2. Parts mode: Pass prefix/infix/suffix; unspecified parts get UUID defaults.
   ``path_factory(infix="!")`` → ``tmp_path/ab12!ef56``
   ``path_factory(suffix=".yml")`` → ``tmp_path/ab12cd34.yml``

:param name: Complete path name (mutually exclusive with prefix/infix/suffix)
:param prefix: Prefix for generated name (mutually exclusive with name param)
:param infix: Infix for generated name (mutually exclusive with name param)
:param suffix: Suffix for generated name (mutually exclusive with name param)
:return: A new unique path
z;name and (prefix or infix or suffix) are mutually exclusive:N   N:r      N:r      N)
ValueErrorr   uuiduuid4hex)r   r=   r   r   r   randoms   &&$$$ r1   r   PathFactoryFixture.__call__t  s    > VuM  ==4''ZZ\%%F))vbzF((VC[E++vd|F==FNV$;<<r0   r/   rA   )r   r   r   r   r   r   r   r/   r0   r1   r   r   p  s/    N*= "	*=
 !*= "*= *=r0   r   c                    V ^8  d   QhRRRR/# )rG   r   r   rI   zIterator[PathFactoryFixture]r/   )rK   s   "r1   rL   rL     s     ' '4 '$@ 'r0   c              #  (   "   \        V 4      x  R# 5i)zA function scoped fixture returning PathFactoryFixture instance.

Use this to generate any number of temporary paths for the test that are unique and
do not exist yet.
N)r   )r   s   &r1   path_factoryr     s      X
&&r   c                  n    ] tR tRt$ R]R&   R]R&   RR R llt]R	RR
RRRRRRRRR/R R ll4       tRtR# )TmpEnvFixturei  z$PathFactoryFixture | TempPathFactoryr   ry   r   Nc          
     ,    V ^8  d   QhRRRRRRRRRR/# r   r/   )rK   s   "r1   rL   TmpEnvFixture.__annotate__  s<        	
  
r0   c                	   \        V P                  \        4      '       d   V P                  VVVVR 7      # V P                  P                  T;'       g/    T;'       g    RT;'       g    R,           T;'       g    R,           4      # ))r=   r   r   r   ztmp_env- )
isinstancer   r   rP   )r   r=   r   r   r   s   &&&&&r1   get_pathTmpEnvFixture.get_path  s     d'');<<$$	 %   $$++QQ&..J5;;B?6<<RP r0   r   r=   path_prefix
path_infixpath_suffixshallowc               8    V ^8  d   QhRRRRRRRRRRR	RR
RRR/# )rG   argsr7   r   zstr | os.PathLike | Noner=   r   r   r   r   r   zbool | NonerI   rJ   r/   )rK   s   "r1   rL   r     sd     C CC )C 	C
  C C  C C 
Cr0   c             '    "   V'       d   V'       d   \        R4      hV'       d,   V'       g   V'       g   V'       g	   V'       d   \        R4      h\        T;'       g    V P                  VVVV4      4      pV'       g   VfD   V'       g<   V\        ,          pVP                  P                  RRR7       VP                  4        MV P                  ! RRV 2.VORNR	N5!   Vx  R# 5i)
u  Generate a conda environment with the provided packages.

Path customization (mutually exclusive options):

1. Auto-generated path (default): Unique path in tmp_path.
   ``tmp_env()`` → ``tmp_path/ab12cd34ef56`` (12-char UUID)

2. Custom prefix: Specify exact location.
   ``tmp_env(prefix="/path/to/env")`` → ``/path/to/env``

3. Name mode: Specify env name directly.
   ``tmp_env(name="my-test-env")`` → ``tmp_path/my-test-env``

4. Parts mode: Customize path name generation (useful for special char testing).
   ``tmp_env(path_infix="!")`` → ``tmp_path/ab12!ef56``

:param args: Arguments to pass to conda create (e.g., packages, flags)
:param prefix: Exact prefix path (mutually exclusive with name/path_* params)
:param name: Env name (mutually exclusive with prefix/path_* params)
:param path_prefix: Prefix for path name (mutually exclusive with prefix/name params)
:param path_infix: Infix for path name (mutually exclusive with prefix/name params)
:param path_suffix: Suffix for path name (mutually exclusive with prefix/name params)
:param shallow: If True, create env on disk only without conda create
:return: The conda environment's prefix
z.shallow=True cannot be used with any argumentszTprefix and (name or path_prefix or path_infix or path_suffix) are mutually exclusiveNT)parentsexist_okcreate	--prefix=--yes--quiet)r   r   r   r   parentmkdirtouchr   )	r   r   r=   r   r   r   r   r   r;   s	   &$$$$$$* r1   r   TmpEnvFixture.__call__  s     H tMNNt{jKf    }}	
 wt--DKKdT:JJLNNF8$  	
  s7   C)C)C)C)C)C)C) C) C)AC)r/   )NNNN)	r   r   r   r   r   r   r   r   r   r/   r0   r1   r   r     sk    66* C ,0C  	C
 #'C "&C #'C  $C Cr0   r   c               $    V ^8  d   QhRRRRRR/# )rG   r   r   r   ry   rI   Iterator[TmpEnvFixture]r/   )rK   s   "r1   rL   rL     s&     1 1$11 1r0   c              #  (   "   \        W4      x  R# 5i)zA function scoped fixture returning TmpEnvFixture instance.

Use this when creating a conda environment that is local to the current test.
Nr   r   r   s   &&r1   tmp_envr     s      
00r   c                    V ^8  d   QhRRRR/# )rG   r   r   rI   r   r/   )rK   s   "r1   rL   rL     s      }  r0   c                f    V ! RR7      ;_uu_ 4       pVuuRRR4       #   + '       g   i     R# ; i)zuA function scoped fixture returning an empty environment.

Use this when creating a conda environment that is empty.
T)r   Nr/   )r   r   s   & r1   	empty_envr     s#     
		& 
			s   0	c               $    V ^8  d   QhRRRRRR/# )rG   rR   r%   r   ry   rI   r   r/   )rK   s   "r1   rL   rL   %  s&     = =%=&= =r0   c              #  (   "   \        W4      x  R# 5i)zA session scoped fixture returning TmpEnvFixture instance.

Use this when creating a conda environment that is shared across tests.
Nr   )rR   r   s   &&r1   session_tmp_envr  $  s      (
<<r   c                  B    ] tR tRt$ R]R&   R]R&   ]R R l4       tRtR	# )
TmpChannelFixturei0  r   r   ry   r   c                    V ^8  d   QhRRRR/# )rG   specsr7   rI   zIterator[tuple[Path, str]]r/   )rK   s   "r1   rL   TmpChannelFixture.__annotate__6  s     M1 M1s M1'A M1r0   c              '  	  "   V P                   ! R RV P                  4        2.VORNRNRN5R\        /  \        \        P
                  ! 4       P                  4      p\	        V4      pV P                  4       pV\        P                  ,          pVP                  RR7       VR,          pVP                  RR7       R	R
R/R/ R/ /pR	R
VP                  /R/ R/ /p\        V4      p	/ p
V	'       EdD   V	P                  ^ 4      pVP                  V4       EF  pVR,          pW9   d   W,          P                  V4       MV0W&   VP                  p\        V4      P!                  4       '       d   TpMW-,          pVP                  R8X  d   TpTpMTpTp\#        VVV,          4       VP%                  R4      '       d   RMRp\'        R/ VP)                  4       P+                  4        UUu/ uF  w  ppVR9  g   K  VVbK  	  uppB VV,          V&   V	P-                  VP.                  4       EK  	  EKL  VR,          P1                  \2        P4                  ! V4      4       VR,          P1                  \2        P4                  ! V4      4       \6        P8                  ! V
P;                  4       4       F.  p\=        \	        V4      P                  V4      4      '       d   K.  Q h	  V\?        \A        V4      4      3x  R# u uppi 5i)r   r   r   r   z--download-onlyr}   Tr   noarchinfosubdirpackageszpackages.condafnz.tar.bz2zrepodata.jsonNr/   )urlchannelschannelchannel_name)!r   r   r   r   r   first_writablerS   r   r  r   r=   listpopqueryaddpackage_tarball_full_pathis_filer	   endswithr   dumpitemsextenddepends
write_textr   dumpsr   from_iterablevaluesanyr   r7   )r   r  rS   
pkgs_cacher  r  r
  noarch_packagessubdir_packages
iter_specsseenspecpackage_recordfnametarballsourcetargetr  keyfieldvalues   &*                   r1   r   TmpChannelFixture.__call__5  s     	))+,-	
 	
 		

 	
 	
 !	
 (779BBC%h/
##%7>>)T"8#T" Xx(b9
 Xv{{+b9

 %[
$&j>>!$D","2"24"8&t,=KOOD)#'&DK )BB=((**$F%-F!((H4#F.H#F.H%0 %*NN:$>$>jDT'4 ( -;,?,?,A,G,G,I,ILE5 (VV %u,I(e$ !!."8"89A #9D 
/	!--djj.IJ	/	!--djj.IJ ''6D'177=>>>> 7 {3w<000!s&   C-L0C8L(K;9K; CL$Lr/   N)r   r   r   r   r   r   r   r   r/   r0   r1   r  r  0  s"    $$M1 M1r0   r  c               $    V ^8  d   QhRRRRRR/# )rG   r   r   r   ry   rI   zIterator[TmpChannelFixture]r/   )rK   s   "r1   rL   rL     s&     5 5$55 !5r0   c              #  (   "   \        W4      x  R# 5i)z?A function scoped fixture returning TmpChannelFixture instance.N)r  r   s   &&r1   tmp_channelr5    s      L
44r   rH   r=   c                    V ^8  d   QhRRRR/# )rG   rH   r$   rI   r/   )rK   s   "r1   rL   rL     s      ; ; r0   c              #  \  "   V x  V P                    UUUu. uF7  w  rpV\        P                  J g   K  VP                  R4      '       g   K5  VNK9  	  uppp;p'       dC   \        P                  RRP                  V4      4       V P                  4        \        . 4       R# R# u upppi 5i)z:A monkeypatch fixture that resets context after each test.CONDA_z-monkeypatch cleanup: undo & reset context: %sz, N)	_setitemosenviron
startswithlogdebugjoinundor   )rH   objr=   _
conda_varss   &    r1   context_aware_monkeypatchrE    s      
 (000LCq"** 	!%!: 	0 z 
 			;TYYz=R	
 	b s"   B,B%B%B%B,!AB,c               $    V ^8  d   QhRRRRRR/# rG   r   r   mockerr&   rI   rJ   r/   )rK   s   "r1   rL   rL     s$     5 5$5.;55r0   c              #  P  "   V ! 4       R,          pVP                  RR7       V\        ,          P                  4        VP                  RVP                  \        V4      ;p3R7       \        P                  V38X  g   Q hVx  \        P                  P                  VR4       R# 5i)zHA function scoped fixture returning a temporary package cache directory.rN   Tr	  z$conda.base.context.Context.pkgs_dirsnew_callablereturn_valueN)r   r   r   patchPropertyMockr7   r   	pkgs_dirsr   _cache_r  )r   rH  rS   pkgs_dir_strs   &&  r1   tmp_pkgs_dirrR    s     
 ~&HNN4N ((//1
LL.((&)(m3l5  
 ///
N  t4s   B$B&c               $    V ^8  d   QhRRRRRR/# rG  r/   )rK   s   "r1   rL   rL     s$      $.;r0   c              #     "   V ! 4       R,          pVP                  RR7       VP                  RVP                  \        V4      ;p3R7       \        P
                  V38X  g   Q hVx  R# 5i)zFA function scoped fixture returning a temporary environment directory.envsTr	  z$conda.base.context.Context.envs_dirsrJ  N)r   rM  rN  r7   r   	envs_dirs)r   rH  envs_direnvs_dir_strs   &&  r1   tmp_envs_dirrY    sj     
 ~&HNN4N 
LL.((&)(m3l5  
 ///
Ns   A)A+)r4   r(   c               #     "   R\         P                  9   d   Rx  R# \        P                  P	                  4       ;_uu_ 4       p V P                  R\        4       Rx  RRR4       R#   + '       g   i     R# ; i5i)a  
We need to set this so Python loads the dev version of 'conda', usually taken
from `conda/` in the root of the cloned repo. This root is usually the working
directory when we run `pytest`.
Otherwise, it will import the one installed in the base environment, which might
have not been overwritten with `pip install -e . --no-deps`. This doesn't happen
in other tests because they run with the equivalent of `python -m conda`. However,
some tests directly run `conda (shell function) which calls `conda` (Python entry
point). When a script is called this way, it bypasses the automatic "working directory
is first on sys.path" behavior you find in `python -m` style calls. See
https://docs.python.org/3/library/sys_path_init.html for details.

PYTHONPATHN)r;  r<  r   r$   r   rQ   r   )rH   s    r1   r[  r[    sO      rzz!''))[|->? *)))s   AA=A)
A=)A:	4	A=c                   V ^8  d   QhRR/# )rG   rI   Noner/   )rK   s   "r1   rL   rL     s      $ r0   c            	         \        4        \        P                  ! R \        P                  ! R \
        P                  ! \        4      4      /4       R# )testdataN)r   r   _set_raw_datar   make_raw_parametersr   loadsTEST_CONDARCr/   r0   r1   context_testdatard    s9    O(<<DJJ|4	
r0   c                  d    ] tR tRt$ RtR]R&   R]R&   R]R&   R]R	&   R
]R&   R tRR R lltRtR# )HttpTestServerFixturei  z;Fixture providing HTTP test server for serving local files.zhttp.server.ThreadingHTTPServerserverr7   hostintportr  r   	directoryc                F    \         P                  RV P                  4       R# )z!Log server startup for debugging.zHTTP test server started: %sN)r>  r?  r  )r   s   &r1   __post_init__#HttpTestServerFixture.__post_init__  s    		0$((;r0   c                    V ^8  d   QhRRRR/# )rG   r;   r7   rI   r/   )rK   s   "r1   rL   "HttpTestServerFixture.__annotate__  s     : :C : :r0   c                n    VP                  R4      pV'       d   V P                   RV 2# V P                  # )z
Get full URL for a given path on the server.

:param path: Relative path on the server (e.g., "subdir/package.tar.bz2")
:return: Full URL
/)lstripr  )r   r;   s   &&r1   get_urlHttpTestServerFixture.get_url  s2     {{3'+$((1TF#99r0   r/   N)r   )	r   r   r   r   r   r   rm  rt  r   r/   r0   r1   rf  rf    s.    E++
I
I	HO<: :r0   rf  c               $    V ^8  d   QhRRRRRR/# )rG   r?   r#   r   r   rI   zIterator[HttpTestServerFixture]r/   )rK   s   "r1   rL   rL     s+     B BB$B %Br0   c           	   #  V  "   ^RI Hp \        V RR4      ;p'       dn   \        V4      pVP	                  4       '       g   \        RV 24      hVP                  4       '       g   \        RV 24      h\        VP                  4       4      pM$V! RR7      pVP                  4        \        V4      pVP                  V4      pVP                  P                  4       R,          w  rxR	V9   d   R
V R2MTp	RV	 R	V 2p
\        VVVV
\        V4      R7      pVx  VP                  4        R# 5i)a  
Function-scoped HTTP test server for serving local files.

This fixture starts an HTTP server on a random port and serves files
from a directory. The server supports both IPv4 and IPv6.

Usage without parametrize (dynamic content):
    def test_dynamic(http_test_server):
        # Server uses temporary directory automatically
        (http_test_server.directory / "file.txt").write_text("content")
        url = http_test_server.get_url("file.txt")
        response = requests.get(url)
        assert response.status_code == 200

Usage with parametrize (pre-existing directory):
    @pytest.mark.parametrize("http_test_server", ["tests/data/mock-channel"], indirect=True)
    def test_existing(http_test_server):
        url = http_test_server.get_url("file.txt")
        response = requests.get(url)
        assert response.status_code == 200

Use ``None`` in parametrize to mix pre-existing directories with dynamic content:
    @pytest.mark.parametrize("http_test_server", ["tests/data", None], indirect=True)

:param request: pytest fixture request object
:param path_factory: path_factory fixture for creating unique temp directories
:return: HttpTestServerFixture with server, host, port, url, and directory attributes
:raises ValueError: If parametrized directory is invalid
)http_test_serverr[   NzDirectory does not exist: zPath is not a directory: rx  r6  :NrG   N:[]zhttp://)rg  rh  rj  r  rk  )r   rx  getattrr   existsr   is_dirr7   resolver   run_test_serversocketgetsocknamerf  shutdown)r?   r   http_server_modulerk  directory_path
server_dirrg  rh  rj  url_hostr  fixtures   &&          r1   rx  rx    s#    D 9GWd33y3 i$$&&9)EFF$$&&8DEE..01	 "'9:

O	//	:F**,R0JD!Tk4&{tHH:Qtf
%C#y/G M OOs   A D)#CD))nr   
__future__r   r;  r   r   r,   
contextlibr   r   dataclassesr   	itertoolsr   loggingr   pathlibr   shutilr	   typingr
   r   r   r   r:   r   r   r   
auxlib.ishr   base.constantsr   r   base.contextr   r   cli.mainr   common.configurationr   common.serializer   r   
common.urlr   core.package_cache_datar   core.subdir_datar   
exceptionsr   gateways.disk.creater   models.recordsr   integrationr   http.serverhttpcollections.abcr   r    r!   r"   r#   r$   r%   pytest_mockr&   common.pathr'   r   r>  rc  r  r2   r>   rC   rE   rT   r<  getsplitr]   rc   ri   rm   rn   rZ   ry   r   r   r   r   r   r   r   r   r   r  r  r5  rE  rR  rY  r[  rd  rf  rx  r/   r0   r1   <module>r     s   9 " 	    2 !     < < 	     H 1 $ 3 ) $ 6 ) & 5 * &2  *&  "$N @ @ j!& "& 1 1 j! "   ::>>.0BCII#N6	68 2 2 3 3 2 2 
7:.	0BGIDV	W" 4 4 4n " " i   !  == == ==@ i  ! -= -= -=` ' ' ] ] ]D 1 1   i = != R1 R1 R1j 5 5 ]# $$ 5 5(  " i. /*   : : :0 B Br0   