https://docs.pytest.org/en/7.1.x/how-to/doctest.html
pytest --doctest-modules| import inspect | |
| import traceback | |
| from typing import Callable | |
| def stop_recursion(function: Callable): | |
| """Decorator to stop recursion of given function early. | |
| Avoids 'RecursionError: maximum recursion depth exceeded' if | |
| preventing the cause of the recursion is not possible. |
https://docs.pytest.org/en/7.1.x/how-to/doctest.html
pytest --doctest-modules| # https://docs.gunicorn.org/en/stable/design.html#how-many-workers | |
| let num_workers=2*$(nproc --all)+1 | |
| gunicorn --workers $num_workers |
| pip install pytest-watch pytest-testmon | |
| # Build db on first run. | |
| pytest --testmon | |
| # Watch for changes, rerun tests. | |
| ptw -- <pytest-options> | |
| # Together: Watch for changes, rerun tests relevant with changed file(s) only! | |
| ptw -- --testmon <pytest-options> |
| def pytest_itemcollected(item): | |
| """Implement custom marker: @pytest.mark.extra_keywords | |
| Using this we can assign extra keywords to match via the -k CLI | |
| option, so that the test module/class/functionname are not the only | |
| things matched. This makes sense if e.g. certain features should be | |
| matched by name without having to change the test name necessarily. | |
| """ | |
| if not item.own_markers: |
| -- Beep when the OBS (https://obsproject.com) replay buffer has been saved. | |
| -- | |
| -- Slightly edited version of: | |
| -- https://gist.github.com/upgradeQ/b2412242d76790d7618d6b0996c4562f | |
| -- as mentioned in: | |
| -- https://obsproject.com/forum/threads/id-love-some-feedback-when-a-replay-is-saved.129807/ | |
| -- with a less annoying sound and a different event. | |
| -- | |
| -- Add to OBS via: Tools > Scripts > + Button | |
| -- |
| """Point script at Django template name and output DOT text describing the includes. | |
| Use like: | |
| cat visualize_django_template_include_hierarchy_with_graphviz.py | python manage.py shell | |
| Starting template name must be something relative like | |
| 'myapp/mysubfolder/template_1.html'. The script will follow the inputs | |
| and output a text like: |
| # Download remote file to same location on this machine. | |
| # | |
| # Helper is meant to be copied to your own dot files, | |
| # then updated to the remote you use all the time. | |
| # | |
| # Folders are created as needed. | |
| # | |
| # Use like: | |
| # localize /var/log/nginx/access.log | |
| # |
RisingDumbnessValheim.txtecho|set/p=RisingDumbness123|clip > nul
"C:\Program Files (x86)\Steam\Steam.exe" -applaunch 892970 +connect 49.12.229.23:2456RisingDumbnessValheim.bat (dafür müssen Dateiendungen im Windows Explorer angezeigt werden, siehe Ansicht > Dateiendungen anzeigen)RisingDumbness123) ist bereits in der Zwischenablage, füge es einfach per Strg+V ein. Fertig!| from contextlib import contextmanager | |
| from datetime import timedelta | |
| from functools import partial | |
| from typing import Generator | |
| @contextmanager | |
| def _assert_between_num_queries( | |
| config, | |
| min_num: int, | |
| max_num: int, |