HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //lib/python3/dist-packages/twisted/python/test/__pycache__/test_setup.cpython-38.pyc
U

s�@g}0�@s�dZddlZddlmZddlmZddlZddlmZddl	m
Z
mZddlm
Z
ddlmZmZmZmZGd	d
�d
e�ZGdd�de�ZGd
d�de�Zeddd�i�Zeddd�i�ZGdd�de�ZGdd�de�ZdS)z3
Tests for parts of our release automation system.
�N)�parse_requirements)�Distribution)�TestCase)�_setup�filepath)�_PY3)�BuildPy3�getSetupArgs�ConditionalExtension�_EXTRAS_REQUIREc@s eZdZdZdd�Zdd�ZdS)�
SetupTestsz$
    Tests for L{getSetupArgs}.
    cCs�tddgdd�d�}tddgdd�d�}t||gd�}|�|d||g�|d	}|d
}|t��}|��|�|j|g�dS)z�
        Will return the arguments with a custom build_ext which knows how to
        check whether they should be built.
        �whatever�
whatever.ccSsdS)NT���brr�@/usr/lib/python3/dist-packages/twisted/python/test/test_setup.py�<lambda>'�z7SetupTests.test_conditionalExtensions.<locals>.<lambda>)Z	conditioncSsdS)NFrrrrrr)r��
extensionsZext_modules�cmdclass�	build_extN)r
r	�assertEqualr�prepare_extensionsr)�selfZgood_extZbad_ext�argsrr�builderrrr�test_conditionalExtensions!s��
z%SetupTests.test_conditionalExtensionscCs\tddgdgd�}t|gd�}|ddt��}|�tdd	�|��|�|jdd
g�dS)zn
        When building on Windows NT, the WIN32 macro will be defined as 1 on
        the extensions.
        r
r)r
�)�
define_macrosrrr�name�nt)ZWIN32�N)r
r	r�patch�osrrr )rZextrrrrr�test_win32Definition7s�zSetupTests.test_win32DefinitionN)�__name__�
__module__�__qualname__�__doc__rr&rrrrrsrc@speZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�ZdS)�OptionalDependenciesTestsz&
    Tests for L{_EXTRAS_REQUIRE}
    cCs@tdgd�}t|d�}t|�}dd�}|�||�||j��dS)a�
        Setuptools' Distribution object parses and stores its C{extras_require}
        argument as an attribute.

        Requirements for install_requires/setup_requires can specified as:
         * a single requirement as a string, such as:
           {'im_an_extra_dependency': 'thing'}
         * a series of requirements as a list, such as:
           {'im_an_extra_dependency': ['thing']}
         * a series of requirements as a multi-line string, such as:
           {'im_an_extra_dependency': '''
                                      thing
                                      '''}

        The extras need to be parsed with pkg_resources.parse_requirements(),
        which returns a generator.
        �thing)Zim_an_extra_dependency)�extras_requirecSs*i}|��D]\}}tt|��||<q|S)N)�items�listr)ZmyExtrasZparsedExtrasr!�valrrr�canonicalizeExtrascszWOptionalDependenciesTests.test_distributeTakesExtrasRequire.<locals>.canonicalizeExtrasN)�dictrrr-)rZextras�attrs�distributionr1rrr�!test_distributeTakesExtrasRequireMs
�z;OptionalDependenciesTests.test_distributeTakesExtrasRequirecCs||�dt�|�dt�|�dt�|�dt�|�dt�|�dt�|�dt�|�dt�|�d	t�|�d
t�dS)z�
        L{_EXTRAS_REQUIRE} contains options for all documented extras: C{dev},
        C{tls}, C{conch}, C{soap}, C{serial}, C{all_non_platform},
        C{macos_platform}, and C{windows_platform}.
        �dev�tls�conch�soap�serial�all_non_platform�macos_platform�osx_platform�windows_platform�http2N��assertInr�rrrr�"test_extrasRequireDictContainsKeysosz<OptionalDependenciesTests.test_extrasRequireDictContainsKeyscCsXtd}|�d|�|�d|�|�d|�|�d|�tsT|�d|�|�d|�dS)	z�
        L{_EXTRAS_REQUIRE}'s C{dev} extra contains setuptools requirements for
        the tools required for Twisted development.
        r6zpyflakes >= 1.0.0ztwisted-dev-tools >= 0.0.2zpython-subunitzsphinx >= 1.3.1ztwistedchecker >= 0.4.0zpydoctor >= 16.2.0N)rrAr�rZdepsrrr�test_extrasRequiresDevDeps�sz4OptionalDependenciesTests.test_extrasRequiresDevDepscCs0td}|�d|�|�d|�|�d|�dS)z�
        L{_EXTRAS_REQUIRE}'s C{tls} extra contains setuptools requirements for
        the packages required to make Twisted's transport layer security fully
        work for both clients and servers.
        r7�pyopenssl >= 16.0.0�service_identity�idna >= 0.6, != 2.3N�rrArDrrr�test_extrasRequiresTlsDeps�sz4OptionalDependenciesTests.test_extrasRequiresTlsDepscCs0td}|�d|�|�d|�|�d|�dS)z�
        L{_EXTRAS_REQUIRE}'s C{conch} extra contains setuptools requirements
        for the packages required to make Twisted Conch's secure shell server
        work.
        r8�pyasn1�cryptography >= 1.5�appdirs >= 1.4.0NrIrDrrr�test_extrasRequiresConchDeps�sz6OptionalDependenciesTests.test_extrasRequiresConchDepscCs|�dtd�dS)z�
        L{_EXTRAS_REQUIRE}' C{soap} extra contains setuptools requirements for
        the packages required to make the C{twisted.web.soap} module function.
        �soappyr9Nr@rBrrr�test_extrasRequiresSoapDeps�s�z5OptionalDependenciesTests.test_extrasRequiresSoapDepscCs|�dtd�dS)z�
        L{_EXTRAS_REQUIRE}'s C{serial} extra contains setuptools requirements
        for the packages required to make Twisted's serial support work.
        �pyserial >= 3.0r:Nr@rBrrr�test_extrasRequiresSerialDeps�s�z7OptionalDependenciesTests.test_extrasRequiresSerialDepscCs$td}|�d|�|�d|�dS)z�
        L{_EXTRAS_REQUIRE}'s C{http2} extra contains setuptools requirements
        for the packages required to make Twisted HTTP/2 support work.
        r?�h2 >= 3.0, < 4.0�priority >= 1.1.0, < 2.0NrIrDrrr�test_extrasRequiresHttp2Deps�sz6OptionalDependenciesTests.test_extrasRequiresHttp2DepscCs�td}|�d|�|�d|�|�d|�|�d|�|�d|�|�d|�|�d|�|�d	|�|�d
|�|�d|�dS)
z�
        L{_EXTRAS_REQUIRE}'s C{all_non_platform} extra contains setuptools
        requirements for all of Twisted's optional dependencies which work on
        all supported operating systems.
        r;rFrGrHrKrLrOrQrMrSrTNrIrDrrr�%test_extrasRequiresAllNonPlatformDeps�sz?OptionalDependenciesTests.test_extrasRequiresAllNonPlatformDepscCs�td}|�d|�|�d|�|�d|�|�d|�|�d|�|�d|�|�d|�|�d	|�|�d
|�|�d|�dS)
z�
        L{_EXTRAS_REQUIRE}'s C{macos_platform} extra contains setuptools
        requirements for all of Twisted's optional dependencies usable on the
        macOS platform.
        r<rFrGrHrKrLrOrQrSrTzpyobjc-coreNrIrDrrr�$test_extrasRequiresMacosPlatformDeps�sz>OptionalDependenciesTests.test_extrasRequiresMacosPlatformDepscCs|�tdtd�dS)zX
        L{_EXTRAS_REQUIRE}'s C{osx_platform} is an alias to C{macos_platform}.
        r<r=N)rrrBrrr�$test_extrasRequireMacOSXPlatformDeps�s
�z>OptionalDependenciesTests.test_extrasRequireMacOSXPlatformDepscCs�td}|�d|�|�d|�|�d|�|�d|�|�d|�|�d|�|�d|�|�d	|�|�d
|�|�d|�dS)
z�
        L{_EXTRAS_REQUIRE}'s C{windows_platform} extra contains setuptools
        requirements for all of Twisted's optional dependencies usable on the
        Microsoft Windows platform.
        r>rFrGrHrKrLrOrQrSrTZpywin32NrIrDrrr�&test_extrasRequiresWindowsPlatformDeps�sz@OptionalDependenciesTests.test_extrasRequiresWindowsPlatformDepsN)r'r(r)r*r5rCrErJrNrPrRrUrVrWrXrYrrrrr+Hs"
r+c@s eZdZdZdd�Zdd�ZdS)�
FakeModulezF
    A fake module, suitable for dependency injection in testing.
    cCs
||_dS)z�
        Initializes a fake module.

        @param attrs: The attrs that will be accessible on the module.
        @type attrs: C{dict} of C{str} (Python names) to objects
        N)�_attrs)rr3rrr�__init__szFakeModule.__init__cCs,z|j|WStk
r&t��YnXdS)z�
        Gets an attribute of this fake module from its attrs.

        @raise AttributeError: When the requested attribute is missing.
        N)r[�KeyError�AttributeError)rr!rrr�__getattr__szFakeModule.__getattr__N)r'r(r)r*r\r_rrrrrZ
s
rZZpython_implementationcCsdS)NZCPythonrrrrrr%rrcCsdS)NZlvhpyrrrrrr&rc@s eZdZdZdd�Zdd�ZdS)�WithPlatformTestszP
    Tests for L{_checkCPython} when used with a (fake) C{platform} module.
    cCs|�tjtd��dS)z�
        L{_checkCPython} returns C{True} when C{platform.python_implementation}
        says we're running on CPython.
        ��platformN)Z
assertTruer�
_checkCPython�fakeCPythonPlatformrBrrr�test_cpython.szWithPlatformTests.test_cpythoncCs|�tjtd��dS)z�
        L{_checkCPython} returns C{False} when C{platform.python_implementation}
        says we're not running on CPython.
        raN)ZassertFalserrc�fakeOtherPlatformrBrrr�
test_other6szWithPlatformTests.test_otherN)r'r(r)r*rergrrrrr`*sr`c@s$eZdZdZdZesdZdd�ZdS)�
BuildPy3Testsz 
    Tests for L{BuildPy3}.
    Nz4BuildPy3 setuptools command used with Python 3 only.cCs�t�}d|_d|_t|�}|�tddg�t�tj	��
�}|�d��d�}|�d|j
�}|�tdd|�d	�j
fdd
|�d�j
fdd|�d
�j
fdd|�d�j
fg�t|��dS)zp
        Will filter the found modules excluding the modules listed in
        L{twisted.python.dist3}.
        zsetup.pyZbuild_pyZnotPortedModulesz"twisted.spread.test.test_pbfailureZspreadZtestztwisted.spread.testr\z__init__.pyZtest_bananaztest_banana.pyZ
test_jellyz
test_jelly.pyZtest_pbz
test_pb.pyN)r�script_nameZscript_argsrr$rrZFilePath�twisted�__file__�parentZchildZfind_package_modules�pathr�sorted)rr4rZtwistedPackageDirZ
packageDir�resultrrr�test_find_package_modulesHs>���
�
�
�
��
�z'BuildPy3Tests.test_find_package_modules)r'r(r)r*ZmaxDiffr�skiprprrrrrh?s
rh)r*r%Z
pkg_resourcesrZsetuptools.distrrjZtwisted.trial.unittestrZtwisted.pythonrrZtwisted.python.compatrZtwisted.python._setuprr	r
rrr+�objectrZrdrfr`rhrrrr�<module>s 	,C