added completly new version for haslach 2025

This commit is contained in:
fotobox
2025-03-17 03:47:13 +01:00
parent 152832515c
commit 769ab91da8
2333 changed files with 409208 additions and 341 deletions

View File

@@ -0,0 +1,15 @@
**Copyright 2015 Martin Richard**
* * *
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@@ -0,0 +1,156 @@
Metadata-Version: 2.1
Name: asynctest
Version: 0.13.0
Summary: Enhance the standard unittest package with features for testing asyncio libraries
Home-page: https://github.com/Martiusweb/asynctest/
Author: Martin Richard
Author-email: martius@martiusweb.net
License: Apache 2
Keywords: unittest,test,testing,asyncio,tulip,selectors,async,mock
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Testing
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Requires-Python: >=3.5
.. image:: https://img.shields.io/pypi/v/asynctest.svg
:target: https://pypi.python.org/pypi/asynctest
:alt: PyPI
.. image:: https://travis-ci.org/Martiusweb/asynctest.svg?branch=master
:target: https://travis-ci.org/Martiusweb/asynctest
:alt: Travis
.. image:: https://ci.appveyor.com/api/projects/status/github/Martiusweb/asynctest?branch=master&svg=true
:target: https://ci.appveyor.com/project/Martiusweb/asynctest/branch/master
:alt: AppVeyor
.. image:: https://img.shields.io/pypi/pyversions/asynctest.svg
:target: https://github.com/Martiusweb/asynctest
:alt: Supported Python versions
=========
asynctest
=========
The package asynctest is built on top of the standard unittest module and
cuts down boilerplate code when testing libraries for asyncio.
Currently, asynctest targets the "selector" model, hence, some features
will not (yet?) work with Windows' proactor.
.. warning::
Since asynctest 0.13, Python 3.4 is not supported anymore.
Author & license
----------------
Authored by Martin Richard <martius@martiusweb.net> and licensed under the
Apache 2 license.
See the AUTHORS file for a comprehensive list of the authors.
Documentation
-------------
.. image:: https://readthedocs.org/projects/asynctest/badge/
:target: http://asynctest.readthedocs.org/en/latest/
Full documentation is available at http://asynctest.readthedocs.org/en/latest/.
It includes a tutorial with tested examples of how to use ``TestCase`` or
mocks.
Features
--------
TestCases
~~~~~~~~~
- Initialize and close a loop created for each test (it can be
configurated), if the loop uses a selector, it will be updated with
a TestSelector object wrapping the original selector (see below),
- if the test function is a coroutine function or returns a coroutine, it
will run on the loop,
- TestCase.setUp() and TestCase.tearDown() can be coroutine functions,
- control post-test checks with `@fail_on`, for instance, the test fail if
the loop didn't run, some optional checks can be activated,
- ClockedTestCase allows to control the loop clock and run timed events
without waiting the wall clock.
Mock and CoroutineMock
~~~~~~~~~~~~~~~~~~~~~~
- CoroutineMock is a new Mock class which mocks a coroutine function, and
returns a coroutine when called,
- MagicMock supports asynchronous context managers and asynchronous
iterators,
- NonCallableMock, Mock and CoroutineMock can return CoroutineMock objects
when its attributes are get if there is a matching attribute in the spec
(or spec_set) object which is a coroutine function,
- patch(), patch.object(), patch.multiple() return a MagickMock or
CoroutineMock object by default, according to the patched target,
- patch(), patch.object(), patch.multiple() handle generators and coroutines
and their behavior can be controled when the generator or coroutine pauses,
- all the patch() methods can decorate coroutine functions,
- mock_open() returns a MagickMock object by default.
- return_once() can be used with Mock.side_effect to return a value only
once when a mock is called.
Selectors
~~~~~~~~~
The module asynctest.selector provides classes to mock objects performing IO
(files, sockets, etc).
- FileMock is a special type of mock which represents a file.
FileMock.fileno() returns a special value which allows to identify uniquely
the mock,
- SocketMock is a special type of FileMock which uses socket.socket as spec,
- TestSelector is a custom selector able to wrap a real selector
implementation and deal with FileMock objects, it can replace a selector
loop by calling `loop._selector = TestSelector(loop._selector)`, and will
intercept mock so they don't get registered to the actual selector.
- set_read_ready() and set_write_ready() to force read and write event
callbacks to be scheduled on the loop, as if the selector scheduled them.
Helpers
~~~~~~~
- the coroutine exhaust_callbacks(loop) returns once all the callbacks which
should be called immediately are executed, which is useful when the test
author needs to assert things which are not yet executed by the loop.
Roadmap
-------
I hope I will find time to develop and release the following features:
- set of warnings against common mistakes
- proactor support
Tests
-----
asynctest is unit tested. You can run asynctest test suite with this command::
$ PYTHONPATH=. python -m unittest test

View File

@@ -0,0 +1,19 @@
asynctest-0.13.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
asynctest-0.13.0.dist-info/LICENSE.md,sha256=N92n5NWo9gBrsaAIM9pwlEFUXI5Ochqwc3mm7jjWU7k,566
asynctest-0.13.0.dist-info/METADATA,sha256=7B8Egkv18tUVoTu8sa4AwxxhUFLs4PgPuckM5ajb9x0,5375
asynctest-0.13.0.dist-info/RECORD,,
asynctest-0.13.0.dist-info/WHEEL,sha256=S8S5VL-stOTSZDYxHyf0KP7eds0J72qrK0Evu3TfyAY,92
asynctest-0.13.0.dist-info/top_level.txt,sha256=nMxIbZ7H0Gsr_yqW6FR5IRtuBHrXjCmyeLx2HkmpDXM,10
asynctest-0.13.0.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
asynctest/__init__.py,sha256=MgO982exy23YDu9vXL1yse3Q_FFtAk1MRxpkNUkk_tU,884
asynctest/__pycache__/__init__.cpython-37.pyc,,
asynctest/__pycache__/_fail_on.cpython-37.pyc,,
asynctest/__pycache__/case.cpython-37.pyc,,
asynctest/__pycache__/helpers.cpython-37.pyc,,
asynctest/__pycache__/mock.cpython-37.pyc,,
asynctest/__pycache__/selector.cpython-37.pyc,,
asynctest/_fail_on.py,sha256=e4K7zHO02VnI2Gnc93eaRHX17U2GYh9IaLEh-dQxPV8,4265
asynctest/case.py,sha256=o76pu70nSfdi2krBKPhAr-CJ6qq2TSvEVwMoI55CbME,17653
asynctest/helpers.py,sha256=X5lxIN_Dad_KimV8eE2kZsSq5enVY5uW0-orY5szKmk,527
asynctest/mock.py,sha256=FtWuAAMJqq6vtClKzijUBY0Hd7K9oMW5_qu_AKMQyhY,48928
asynctest/selector.py,sha256=eWtnlnv06-R27_dpUyVVK6qOvmFKt_q9eD7LfmRz-zg,11692

View File

@@ -0,0 +1,5 @@
Wheel-Version: 1.0
Generator: bdist_wheel (0.33.4)
Root-Is-Purelib: true
Tag: py3-none-any

View File

@@ -0,0 +1 @@
asynctest